aspose file tools
The moose likes Game Development and the fly likes What does it mean to convert tile positions to pixel positions in a tilebased map? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Game Development
Reply Bookmark "What does it mean to convert tile positions to pixel positions in a tilebased map?" Watch "What does it mean to convert tile positions to pixel positions in a tilebased map?" New topic
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?
 
Threads others viewed
What does it mean when a conditional has only the keyword "true" for a condition?
Need help with screen offset
Why does a char value also have an integer value?
What should a 2d tile-based map basically have???
Animation Threads...
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture