Tiled, Diddy, Grabbing Player Start Position?
Monkey Forums/Monkey Programming/Tiled, Diddy, Grabbing Player Start Position?
| ||
Ok, when I make my TileMap in Tiled what do I do to add a Player Start position and how do I grab that position in MonkeyCode? I've implemented my GetX() | GetY() functions but I'm at a loss on how I set it up to grab the player positions or even how I would sort that in Tiled. It's 3am here in freezing cold London so soz if my post is a bit badly worded. |
| ||
Have a look at the platformer example code. Something like this: Local reader:MyTiledTileMapReader = New MyTiledTileMapReader Local tm:TileMap = reader.LoadMap("levels/level1.tmx") tilemap = MyTileMap(tm) Local playerStart:TileMapObject = tilemap.FindObjectByName("playerStart") player = New Player(game.images.Find("gripe.stand_right"), playerStart.x, playerStart.y) |
| ||
Hi! Where are playerStart.x/y defined in Tiled? When in Object Mode in Tiled how do I define those start positions? |
| ||
Tiled maps don't have the concept of "player start locations". You need to tell the renderer where to start rendering. You can however use a Tiled object on an object layer and call it something like "player", then read/update the coordinates from that to use for rendering. |
| ||
Thanks guys! Got it working nice! |