Jump to content

Wrong Tiling?


Schoening
 Share

Recommended Posts

Guys.. I am tiling a map, but it is flipped wrongly!

 

I am pretty sure that this would tile correctly in a plain Canvas.

The "T" is to error check, and should not display tiles on the Left side..

Instead they don't display on top: So the whole thing is flipped, or some evil magic, any clues?

 

badtiling_zps36c2b391.png

        var map = [        [s,S,S,S,S,S,S,S,S,S,],        [s,S,S,S,S,S,S,S,S,S,],        [s,S,S,S,S,S,S,S,S,S,],        ["T",S,S,S,S,S,S,S,S,S,],        [s,S,S,S,S,S,S,S,S,S,],        [s,S,S,S,S,S,S,S,S,S,],        [s,S,S,S,S,S,S,S,S,S,],        ["T",S,S,S,S,S,S,S,S,S,],        [s,S,S,S,S,S,S,S,S,S,],        [s,S,S,S,S,S,S,S,S,S,]        ];        var map_tile_size = 32;        var map_offset = 48;        var sandTile = PIXI.Texture.fromImage("sand.png");        // Spawn Tiles based on the Map Array:        for(var x = 0; x < map.length; x++){        	for(var y = 0; y < map[x].length; y++){        		if(map[x][y] === S){        		map[x][y] = new PIXI.Sprite(sandTile);        		// center the sprites anchor point                map[x][y].anchor.x = 0.5;                map[x][y].anchor.y = 0.5;                // move the sprite t the center of the screen                map[x][y].position.x = x * map_tile_size + map_offset;                map[x][y].position.y = y * map_tile_size + map_offset;        		stage.addChild(map[x][y]);        		map[x][y].setInteractive(true);        		}        	}        }

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...