Home Projects Flash CS3 How to Create a Random Wheel Game Like the Wheel of Excitement on Neopets.com





Forgot your password?
Forgot your username?
No Account Yet? Create an account

Like it? Share it!

Add to: JBookmarks Add to: Facebook Add to: Windows Live Add to: Ximmy Add to: Digg Add to: Del.icoi.us Add to: Reddit Add to: Jumptags Add to: Upchuckr Add to: StumbleUpon Add to: Slashdot Add to: Netscape Add to: Yahoo Add to: Blogmarks Add to: Diigo Add to: Technorati Information

How to Create a Random Wheel Game Like the Wheel of Excitement on Neopets.com PDF Print E-mail
User Rating: / 7
PoorBest 
Projects - Flash CS3
Written by drooza   
Sunday, 28 September 2008 21:16

Here's a quick and easy example of time-line usage.  Here's the idea: create a movie tween of the wheel with a CW rotation of 10 times over ~70 frames. 

initial tween setup

By the time that finishes create a string with a random number concatenated on the end of it.  This string will be the flag to the frame with the corresponding ending animation.

At the end of the initial animation place this code on the last frame in the actions layer:
var ran:Number = Math.floor(Math.random() * 16) + 1;
var frame:String = "prize" + ran;
//trace(frame); // observability
gotoAndPlay(frame);

The timeline is setup as follows: each animation will have a CW rotation of 1 time over ~24 frames. At the end of each animation the ending key frame will be where the wheel stops - corresponding prize flag - and a stop(); command so the time line will not progress into the next animation.

per prize setup

 Here's what a piece of the time line will look like when a few animations are setup:

timeline setup

 When you're finished  with the animation installments, in order to play the game continuously just add a button to the stage (on every keyframe) and on the keyframe of where the button first appears(should be frame 1) just add this code:

For Actionscript 2.0

 spinAgain_mc.onRelease = function() {
gotoAndPlay(1);
}

For Actionscript 3.0:

spinAgain_mc.addEventListener(MouseEvent.CLICK, spin);
spinAgain_mc.buttonMode = true;
function spin(e:MouseEvent):void {
gotoAndPlay(1);
}

 

Files: wheel.fla

 

 

 

Comments
Add New Search
easy but
.v3! (213.140.15.xxx) 2008-10-10 20:23:47

easy but i loved the comparison of as2 and as3 code, i needto undestand the new
sintax and this is a nice way to do it.

thanks again
SSS
Samindu (124.43.56.xxx) 2008-12-04 19:34:51

this is very useful for me.
Thank You...
Samindu
great job
naren (122.168.89.xxx) 2008-12-08 20:22:50

I HAVE A GREAT FUN PLAYING THIS. IT HELPS ME A LOT IN MY CREATION.THANKS
grate work
naren (122.168.89.xxx) 2008-12-08 20:23:42

good job
x
x (74.34.202.xxx) 2008-12-28 10:02:24

u play neopets??
wow
x
x (74.34.202.xxx) 2008-12-28 10:03:03

but creative i must add!
Great Help
Aaron (81.157.53.xxx) 2009-01-01 11:05:05

Im gonna use this is upcoming games
Help?
Sidra (76.68.108.xxx) 2009-01-04 05:05:24

I am really new to this and I don't even understand the beginning? Like how to I
adjust those settings? Where do I go to get those options?

ok
matija (89.216.241.xxx) 2009-01-24 04:07:11

Bot bad
s7.zetaboards.com/stickman_legacy
Spammaster (82.4.206.xxx) 2009-01-24 07:53:29

Thank you for this!
I've edited it and it will be a great help to me.
I'm
basically using it for a game like Dungeons and Dragons and we don't have any
dice, so I'm just using this

Again: THANK YOU
I have no idea how to use this?
Seanzzzzz (67.183.39.xxx) 2009-02-16 13:43:03

Can some one help me?
Need Help.
marajade312 (67.65.198.xxx) 2009-05-28 05:14:59

I want to put this on my website, but can't figure out how to do it.
Ticker
Ed (71.40.234.xxx) 2009-09-01 13:20:38

How could I add a "ticker" sound to this wheel as it spins? Thank you. I
am an audio engineer so making the sound isnt a problem lol.
Write comment
Name:
Email:
 
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
:angry::0:confused::cheer:B)
:evil::silly::dry::lol::kiss:
:D:pinch::(:shock::X
:side::):P:unsure::woohoo:
:huh::whistle:;):s:!:
:?::idea::arrow:
Please input the anti-spam code that you can read in the image.

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Sunday, 28 September 2008 22:12 )
 

Make a Donation!

Advertisement
Banner

HomeProjectsSnippetsContact Me

Copyright © 2008, Drooza.com