Hello Guest

Author Topic: Tilemap Sprite Size  (Read 5092 times)

Logon

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 20
    • View Profile
Tilemap Sprite Size
« on: February 19, 2013, 07:01:09 am »
I have a problem where a tilemap 100x100 32x32 turns up really small compared to another sprite in my scene

The Scale on the tilemap is x 32 y 32 z 0
The scale on my charactersprite is 1 , 1 , 1

In pixels the tiles should be 32x32 and the character be around 50x50ish but if you look at the editor window you can see the the tiles are very small because the charactersprite is pixel perfect in the game window.

Any ideas?
(Sorry for the bad english)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap Sprite Size
« Reply #1 on: February 19, 2013, 08:33:28 am »
The sprite size in the tilemap depends entirely on the sprite collection size. Perhaps they are set up differently?

Logon

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 20
    • View Profile
Re: Tilemap Sprite Size
« Reply #2 on: February 19, 2013, 05:35:46 pm »
That fixed it, i forgot to use tk2dCamera.

Kirb

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Tilemap Sprite Size
« Reply #3 on: May 07, 2013, 07:35:20 pm »
Actually, I'm having this problem as well. Generally, I have to scale up the tilemaps to x12 to get it around the size I'd like.
I'm not using the tk2dCamera, since we're using perspective parallax. Is there no way to force 1:1 pixel perfect on a tilemap like other sprites?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap Sprite Size
« Reply #4 on: May 07, 2013, 09:49:51 pm »
Use this bit of code to calculate the scale. It is obviously dependent on the distance to your perspective camera.

float zdist = (tilemap.transform.position.z - Camera.main.transform.position.z);
float s = tk2dPixelPerfectHelper.CalculateScaleForPerspectiveCamera(Camera.main.fov, zdist);

And set s to the tilemap scale, and thats it.
You can also get the scale by dragging a sprite from the same collection used in the tilemap, position it at the same z distance as where the tilemap is, 1:1 it, and use that scale value on your tilemap.

Kirb

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Tilemap Sprite Size
« Reply #5 on: May 07, 2013, 11:16:20 pm »
That did the trick, thanks again!