Search code examples
jquerycollision-detectioncollision

Collision (shooting) in a game (jQuery)


I am new to programming (day 3) and I spent the last two days trying to find out how to create the effect of shooting aka:

  1. when the shoe touches the zombie, the zombie will flash and disappear
  2. zombie will appear at the top again in a random fashion.

here is the link: http://jsfiddle.net/Rmva2/

I tried to use the collision plugins as well as following other people's code like: http://jsfiddle.net/98sAG/ but I am still quite confused.

Help will be super appreciated.

Thanks, Agatha


Solution

  • Sprite based collision detection is hard in JavaScript, my suggestion would be to use a circular collision detection algorithm in JavaScript, because it is fast enough to use in real time games and the math is easy to understand. http://strd6.com/2010/06/circular-collision-detection-in-javascript/