1. Home
  2. Computing & Technology
  3. Animation

Making Your Own Flash Slingshot Target Game: III

By , About.com Guide

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.

Explore Animation
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

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

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

All rights reserved.