Replies: 1 comment
-
Your problem appears to be this; the mget and mset functions work with map coordinates, not screen coordinates; you should (presumably, I haven't seen your player drawing code) be dividing the player position by 8, not multiplying it. All the mgets and msets you've been doing have been happening way off to the bottom right of the map area you're rendering; map is presumably rendering the map tiles your setting (or at least, would if they were within the area you were drawing) they're just being set off the screen |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a player sprite, and I'm trying to detect collisions with the tile immediately underneath it. I'm using the following application of mget():
mget( (PlayerSprite.X * 8), ((PlayerSprite.Y + 9) * 8) )
(Multiplying the player's X by 8 to convert to the map cell, and adding 9 to the Y first in order to get the map cell right below the player.)
However, this appears to be irrelevant, since printing the result of mget() always prints "0". mget() is returning 0 even when the parameters point to a map cell that I know is occupied by a specific tile. Am I using this function incorrectly?
EDITS:
So after further research, it seems I overlooked the fact that mget(), mset(), and fget() (and I guess fset(), if it exists?) only apply to tiles, as in sprites with IDs from 0 to 255. I hope there's a similar functionality for sprites, but I can't find anything of this sort online.
This situation is still not seeming to make sense. Using mset() to set tiles (actual tiles, as in sprites with IDs from 0 to 255) leads those tiles to be loaded, which I can verify by printing the result of mget() on those map cells, but the tiles are not drawn to the screen. I found the map() function and tried using that to reload the map every frame, but this just leads to absolutely nothing being drawn to the screen.
I managed to find a workaround by using mset() and spr() to actually get the tiles to draw to the screen, but... surely that's not the intended way to do this, right? This tutorial from the wiki has an example of just using mset() that presumably draws the tile to the screen. I don't understand why I'm experiencing a different result using the same function.
Beta Was this translation helpful? Give feedback.
All reactions