• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code tilemap_get_x/y

babyjeans

Member
Is tilemap_get_x/y(mapId) supposed to return the x/y offsets set in the room editor? I may have missed a topic on this, but it seems to always return 0, despite me setting those values.

File a bug?
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
You can't give the tilemap ID from the room editor as you don't know it. The room editor only permits you to get the LAYER ID. You need to use the layer ID to get the element ID for the tilemap layer, then supply the element ID to the functions to get the x/y.

EDIT: The tilemap_get_x/y entries in the manual explain this and even give an example... you have read the manual, haven't you?
 

babyjeans

Member
Woah woah woah, chill out there buddy.. I have read the manual.. I'm simply looking for clarifications.

Now, before you took your bad day out on me - I had first called "var mapId = layer_tilemap_get_id(layer_get_id("Layer Name"));" This works to receive all the tile data in the world that I want, but I'd like a programmatic way to find out the values I set in the room editor for the X Offset and Y Offset.

From my understanding of the manual, that I did read, I pass that mapId to those functions, and I was expecting to to return those offsets. I get 0 back for both, but I have set the offset to -7, -5 in the editor.

Is there another function to use? I may have missed it when I read the manual.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
lol! It's funny how people read comments in ways very different to how the person writing them reads them... My comment was meant in a humorous way and not hostile at all! I sometimes forget that people don't realise that I am the one that writes the manual, so the irony of my comments obviously is missed. I should probably have added a smiley at the end too... :D

Anyway... If you are passing a correct and functioning tilemap ID into the get x/y functions then it should indeed return the offsets for that element on the given layer. If it's not then it would suggest a bug and I'd appreciate it you'd file it as one and supply a link to a YYZ of the project that shows the issue.
 

babyjeans

Member
Sorry I interpreted that aggressively, thanks for clarifying!

And thanks for the reply, after GM48 I'll make a test project with the issue and submit a bug with my findings.

I was mainly not sure if tilemap_get_x / tilemap_x were not the same thing as the XOffset in the editor (since it's technically set on the layer, I was wondering if we're missing some sort of layer_tilemap_offset). Admittedly, I haven't tried manually moving it with tilemap_x and seeing if that gives me anything but 0 with tilemap_get_x... so that'll be a good test.
 
Top