Jump to content

Tilemap is scaling up very huge


locohost
 Share

Recommended Posts

Hello, thanks for helping with this. I'm completely new to Phaser. I've been reading tutorials and searching for an answer as to why my tilemap tiles are scaling up incredibly huge.

 

This is a screen clip of a corner of the tileset in the Tiled editor...

 

post-10952-0-18293200-1412294556.png

 

Here is how it renders in Phaser game using latest Chrome in Win7...

 

post-10952-0-32014300-1412294685.png

 

Here is the code I'm using from a tutorial...

	create: function () { 		this.scale.scaleMode = Phaser.ScaleManager.RESIZE;		map = game.add.tilemap('map'); // Preloaded tilemap		map.addTilesetImage('OfficeWalls', 'tileset'); // Preloaded tileset		layer = map.createLayer('Tile Layer 1'); // This is the default name of the first layer in Tiled		layer.resizeWorld(); // Sets the world size to match the size of this layer.		layer.debug = true;		map.setCollisionBetween(0, 100); 		cursors = game.input.keyboard.createCursorKeys();	},

Can you tell me what I'm doing wrong?

 

I'd greatly appreciate any expert advice :-)

 

Mark

 

Link to comment
Share on other sites

It seems that there is an error on loading the tileset image (the green lines indicate that no texture is used).

There should be an error or warning in the console (For chrome ctrl+alt+J) mentioning a problem with loading. What does it say?

 

Can you also show us the section of the preload function where you preload the tileset?

Link to comment
Share on other sites

@j0hnskot: Thanks for replying! Within an hour or so after posting, I worked it out. Of course  ;)

 

The large green "wall" outline shapes are the layer.debug lines around my actual walls. My walls are black and the default background (here was my stupidity) is also black. So the map was rendering just fine, but it was black on black then showing the debug green borders. I didn't know what the green debug borders were so I was very puzzled by the display. I added a light gray background color and then, amazing, the map looks right  :blink:

 

Thank you again @j0hnskot  :)

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...