English Get tile ID using X and Y

2 replies
Goto Page
To the start Previous 1 Next To the start
13.04.20 07:36:00 pm
Up
Mami Tomoe
User
Offline Off
I have a tile set that is a 5 x 51 tiles (which means 5 tiles per line)

I also have X and Y that I want to use to find the tile in the appropriate location on the tile set.

That means X:0 Y:0 will give me tile #1 and X:1 Y:0 will give me tile #2, and so on.

What is the most efficient way to do this? I remember doing this in the past but I'm unsure if it worked and I'm fairly certain it wasn't in Lua.

Help would be appreciated, you will be credited in my project.

Thanks!
fish
13.04.20 07:53:38 pm
Up
Ortimh
User
Offline Off
Code:
1
y*width + (x+1)
I'm awesome ... and I really like cookies.
13.04.20 08:10:57 pm
Up
Mami Tomoe
User
Offline Off
Thank you, that works flawlessly.
fish
To the start Previous 1 Next To the start