Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Tile_ID and Priorities [Rmxp]

Star

Sponsor

For RMXP

How would you call a specific tile_id's on the Game_Map with priorities of 5 or so? I wanna be able to get their x and y and their shape depending on what tile is used. It's for a script I'm working on.

Thanks for checking this out, if this is too vague or anything I can elaborate more.
 
Tilemaps are stored in a Table class in triple-array so that each tile has x, y, z coordinate.

This table is map_data from Tilemap class

But the catch here is, when you enter like 1, 0, 2 coordinate you will get a Tile ID instead. That if that Tile ID is greater or equal than 384 then it's is a real Tile ID, otherwise it's an Autotile.

To get the position of the tile in the tileset file you need this calculations

for X position:
x = (Tile ID - 384) % 8 * 32

for Y position:
y = (Tile ID - 384) / 8 * 32

Width and Height of the tile is 32x32 of course :biggrin:

And for the Z or the priority you need to get that information from the other 1-dimensional array table where priorities are stored, priorities are 0 to 5 i think and are accessed by tile ID's

So to get a Z (priority) positon

z = priorities_table[Tile ID]

Also some stuff from Help file:

The Z-coordinate of each sprite used to create a tilemap is fixed at a specific value.
- Tiles with a priority of 0 always have a Z-coordinate of 0.
- Priority 1 tiles placed at the top edge of the screen have a Z-coordinate of 64.
- Every time the priority increases by 1 or the next tile down is selected, the Z-coordinate increases by 32.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top