1. Home
  2. Computing & Technology
  3. Animation

Making Your Own Flash Slingshot Target Game: III

By Adrien-Luc Sanders, About.com

5 of 7

Go back to the instance of the slingshot, and back to the ActionScripts assigned to the stone. With the test set up for whether or not collision takes place, we need to tell Flash what to do, and what to do it to, if the test returns a value of true.

onClipEvent (enterFrame) {
if (this.hitTest (_root.squishie1) ) {
_root.squishie1.stop ( ) ;
}
}

We’ve used a simple stop, but added a few parameters so that Flash knows to go back to the root level and find the movie clip instance named squishie1, and stop it in its tracks no matter where it is. This only acts on the top level, though, and the animation contained inside of the clip called squishie1, so this will only stop the side-to-side motion—since that’s all that’s contained on that movie clip’s timeline. All other motion is inside the timelines of the nested movie clips placed inside, so we need to add extra direction to Flash to access those. For the moment, impact should only affect the horizontal motion; the squishies will still continue to bounce up and down, but will stay in one place to do so.

5 of 7

Index: Making Your Own Flash Slingshot Target Game: III

  1. Part 1
  2. Part 2
  3. Part 3
  4. Part 4
  5. Part 5
  6. Part 6
  7. Part 7

Explore Animation

More from About.com

  1. Home
  2. Computing & Technology
  3. Animation
  4. Flash Animation Tutorials
  5. Making Your Own Flash Slingshot Target Game: III

©2008 About.com, a part of The New York Times Company.

All rights reserved.