Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
0
Members

Get tile ID of tilemap at sprite XY

A topic by Orlan Rod created Jul 28, 2016 Views: 972 Replies: 2
Viewing posts 1 to 2

Lets say for example, that i want to get the tile id at 8 pixels bellow the player's y position. How would i go about doing that?

Thanks.

(+1)

for exemple :

you have an actor named "Map" with tilemap Renderer , and one layer

First , you need to get the tileMap with

let map = Sup.getActor("Map").tileMapRenderer.getTileMap()

after that, you can get the TileID from your position with :

let tileID = map.getTileAt(0, Math.floor(this.actor.getX()), Math.floor(this.actor.getY()))

It's just an exemple

Ah okay, cool. Thanks! 8)