Random selection?

  • kaytee
  • Born
  • Born
  • kaytee
  • Posts: 1

Post 3+ Months Ago

i've made this maze game that has 3 different mazes (scenes) you can take.
after a certain (required) scene is played, i'd like one of the mazes to appear at random, so that it gets changed everytime the player plays it again.

how do i make the scenes get chosen at random to be played?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • lostinbeta
  • Guru
  • Guru
  • User avatar
  • Posts: 1402
  • Loc: Philadelphia, PA

Post 3+ Months Ago

You can use Math.random(). For more information on that, check this tutorial out.

http://www.kirupa.com/developer/actions ... random.htm

If you are using frame labels, you can set up an array to house the frame lables, then randomly select from that array.

If you are using frame numbers, just use a gotoAndPlay for the frame number that randomly gets generated.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 14 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.