You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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