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
Right now the collision logic starts by looping through all 8100 tiles to check to see if the cricket is colliding with any of them. Really it should only need to check the (at most) 4 tiles it's touching at the moment. Last time I tried it with ldtk's Tile At function but then I found out that that is internally looping over all the tiles so that made it worse because we were doing that 4 times instead of one, but I think this should be possible if you use some simple maths knowing:
the cricket's coordinates
the relative coordinates of its hitbox's 4 corners
the size of tiles in the map and the map size
this should let let you be able to convert a given coordinate in pixels to a row and column number for the tiles and look up only those for you're interested in from the tiles arrays without having to loop through them.
The text was updated successfully, but these errors were encountered:
Right now the collision logic starts by looping through all 8100 tiles to check to see if the cricket is colliding with any of them. Really it should only need to check the (at most) 4 tiles it's touching at the moment. Last time I tried it with ldtk's Tile At function but then I found out that that is internally looping over all the tiles so that made it worse because we were doing that 4 times instead of one, but I think this should be possible if you use some simple maths knowing:
this should let let you be able to convert a given coordinate in pixels to a row and column number for the tiles and look up only those for you're interested in from the tiles arrays without having to loop through them.
The text was updated successfully, but these errors were encountered: