removing a few pixels with hit detection

When the bunkers in space invaders get hit, only a few pixels are removed. Do I need to use the pixel array to do that.. or can I do it with the set() function (with loadPixels and updatePixels)... or could I somehow do it with my creation below?

I'm using p5.js.

https://www.openprocessing.org/sketch/429876

Tagged:

Answers

  • Answer ✓

    I'd try constructing the bunkers from particles: you can then hit test against them individually and animate them individually when they're hit. Not quite the same effect; but this old demo (source) illustrates that it's perfectly possible in p5 ;)

  • Hey blindfish. I'm still stuck on this. I'm a noob. Is there some book or somewhere I can go to figure out how particles work with an image and in general? Your code is over my head.

    Thanks.

Sign In or Register to comment.