how to make wall detection in a platformer using p5js?
(ignore the repl)
i have planned out a platformer game, but while coding it in vscode i encountered a problem that i don't know how to fix. i don't know how to do wall/collision detection. i have a list of where all the walls and floors are but i have no idea where to start here.
(ps i once saw a p5 phaser game tutorial with wall detection on repl.it, but i can't find it anymore.)
Voters
AABB collisions.
In JavaScript:
@tussiez that would work, except for the fact that i need to figure out how to position/reposition the player, since platformers have gravity. i'm not really looking for code (though if there was a simple p5 or js function for this that would be nice) but more of the math involved
@avibeskrowni p5 is a canvas library, not really a complete game engine. MDN has a good tutorial on very simple physics in canvas. You can try that, or use a physics engine like box2d
@tussiez i've checked out box2d, it's very helpful! thank you
@avibeskrowni Glad to hear!