Skip to main content
January 9, 2014
Question

Randomize frames

  • January 9, 2014
  • 1 reply
  • 625 views

Im a highschool student making a game for my CPT using flash CS6 (Coding with action script 3).  I was wondering what the code would be for something hitting a target, and from there going to a random frame.  Each frame has a question on it. So I want it to be a different question everytime they hit the target.  So the Projectile hits the target, and a random question pops up.

Thanks for the help

Aaron

This topic has been closed for replies.

1 reply

Ned Murphy
Legend
January 9, 2014

Put the frame numbers in an array and then shuffle the array so it is in random order.  Then you can just go thru the array one item at a time.  For the hitting a target aspect, look into using the hitTestObject() method.  What you would do is continuously check if there is a hit until whatever passes that would signify the end of a need to check (like the end of the journey for the missile or the missile hitting the target)

Amy Blankenship
Legend
January 9, 2014

Don't forget to remove the frame number from the array after it has been visited if you don't want to be repeatedly going to the same questions.