| Author |
What does it mean to convert tile positions to pixel positions in a tilebased map?
|
John Quach
Ranch Hand
Joined: Sep 28, 2011
Posts: 45
|
|
Developing Games in Java by David Brackeen
In earlier demos in the book, the sprite's position was relative to the screen, but in this game, the sprite's position is relative to the tile map. You can use the TileMapRender.tilesToPixels() static function to convert tile positions to pixel positions in the map. This function multiplies the number of tiles by the tile size:
int pixelSize = numTiles * TILE_SIZE;
This way, sprites can move around to any position in the map and don't have to be justified with the tile boundaries.
I think I have some idea of this concept. But I'm still lost after a few days of trying to figure it out.
|
 |
 |
|
|
subject: What does it mean to convert tile positions to pixel positions in a tilebased map?
|
|
|