Mr_Fulano
asked on
Collisions in ActionScript
Hi, I'm trying to understand the basic interaction between objects on the stage when they collide.
Lets assume I have a little space ship on my stage. Lets also assume that the space ship fires a projectile missile at an object (another space ship, or a monster...any object).
Given that my two object will be on different layers, how does one object know that it collided with the other object? In the case of my space ship, how does the projectile missile know that it hit it's target and how does the target know that it just got hit, thus causing it to explode (or whatever it does when it gets hit)?
A link to an example would be great.
Thanks for your help,
Fulano
Lets assume I have a little space ship on my stage. Lets also assume that the space ship fires a projectile missile at an object (another space ship, or a monster...any object).
Given that my two object will be on different layers, how does one object know that it collided with the other object? In the case of my space ship, how does the projectile missile know that it hit it's target and how does the target know that it just got hit, thus causing it to explode (or whatever it does when it gets hit)?
A link to an example would be great.
Thanks for your help,
Fulano
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
open video on fullscreen
have a look at corey o'neil's collision detection kit
http://coreyoneil.com/Flash/CDK/documentation/CollisionList.html#checkCollisions
http://coreyoneil.com/Flash/CDK/documentation/CollisionList.html#checkCollisions
ASKER
Thanks,
Fulano