Discord
Login
Community
DARK THEME

mymap.get(x,y) function not recognizing the right tiles

Hi I'm trying to add a collision element to prevent the player from passing through certain blocks. I have added all the blocks onto a tile sheet and made the map using that sheet with the hopes of using mymap.get(x,y).startsWith("sheet") to detect which block to stop in front of and which ones to pass through. However, when I try using mymap.get(x,y), it returns 0 as the player moves across the map even though the map is completely filled with different sprites. I used the coordinates of the player as the arguments in the get method and have confirmed that variables I passed through does reflect the player's coordinate, so i'm not really sure what else could be the problem. I don't know if it's because I made the tile sheet wrong?

"QuickEngine" - has collision checking. Check with public libraries. https://microstudio.dev/i/gilles/quickengine/ My version of this engine is written in JavaScript - https://microstudio.dev/i/Loginus/quickengineinjs/

Here's how to detect collisions with tiles - https://microstudio.io/i/Loginus/mapcollision/ A little example.

Show your code if you still have trouble.

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community