![](/gfx/set_like0.png)
![](/gfx/top_drop.png)
![](/bimg/pi/pi23.png)
I forgot to change the 'btnp' to 'btn' before publishing this but theres still collision issues.
![](/gfx/set_like0.png)
2
![](/gfx/top_drop.png)
![](/media/45608/2_rgbg_avatar.png)
This is a problem that comes up a lot. The method you're using for collision detection only works for grid-aligned movement. If you switch to smooth movement, then your check for collisions only applies to the top-left corner of your character.
The quickest change to your code to fix it would be to change this line
if(can_move(newx,newy)) then |
to this
if(can_move(newx,newy) and can_move(newx+.875,newy) and can_move(newx,newy+.875) and can_move(newx+.875,newy+.875)) then |
To explain, .875 is 1 pixel less than a full tile, as measured in tiles. As such, the other 3 calls to can_move
check the other 3 corners of your character.
[Please log in to post a comment]