Hi!
Flash 8 Actionscript question:
I’m trying to figure out how to get 2 (or more) movie clips to bounce off each other and it’s a bit frustrating since I’m just learning HitTest etc.
What I have:
- I have 2 movie clips, a circle and a square.
- each movie clip has actionscript for the “falling” gravity to work.
- each movie clip has a button in it with actionscript for the dragging and releasing etc.
- When the movie loads, the circle and square drop from the top of the stage and bounce (using gravity etc).
- You can drag and “throw each” object and it will bounce off the sides and bottom of the stage.
What I’m trying to do:
- I’d like the circle and square to bounce off each other when they collide just like they bounce off the sides of the stage (right now they bounce behind or in front of eachother based on their layer depths).
- Also, but less important, I’d like them to bounce off the top of the stage too instead of flying up and out.
Questions:
- How do I make this work? I’ve seen many examples using HitTest etc on instances of one movieclip, but my movie clips need to be different since they will be turned into separate objects/graphics later (if that makes sense). Is this still a HitTest solution? I don’t think so since I’m not really using HitTest to begin with? I’ve tried incorporating code from some of those examples, but it just doesn’t work.
I’ve attached 2 files - one in Flash 8 format, and another in Flash mx2004 format so hopefully someone can open one of them, take a look at the code and give me some help.
I appreciate it
Peace,
Hondo311