p5.js blog post #9

The collisions in and of themselves were not the hard part, but figuring out how to remove the sprites from the canvas was difficult as there’s no easy way to remove preloaded images. I decided to make them slide out of the canvas, and it makes sense with the dead bodies (once I edit the sprite) but less sense with the blood bags.

Setup function code and collision code. Shows dead body sprite in preview.
Shows code for enemy object and the preview screen with the player, pick up item and enemy.

Code: https://editor.p5js.org/robbiery/sketches/by8eiuGLb

Leave a comment