Game Made in p5.js


The collision detection is definitely to be revised ^^


@jb4x I’m glad you got it to work!


The collusion detection could be improved, i will admit. The bounding boxes are a bit off.


I have cut down the size of the hit boxes, hopefully it will be at least a little better now.


The collision detection could be improved further by using 2 boxes for the Penguin and another 2 boxes for the Shark.

It would mean 4 box intersection tests per collision (2x2) rather than the current one but with so few tests to make it won’t be noticeable.


Still good fun!


To add to that, it could even be almost pixel perfect since the shapes are so simple. Ellipses and triangles basically (and maybe 2 squares and circles for the arm of the penguin).

The math for a ellipse/line intersection can easily be found online.