View Full Version : [AS3] Developing 3 reel casino slot
laaptu
12-07-2008, 03:50 AM
Dear users,
I am developing a 3 reel casino slot on actionscript 3. I have already completed my design and I am confused about how to do reel movement animation and how to reference the values of the symbol after the reel stops.
Do you have any suggestion on how to move on in my project and how to do above things.
All your guidance will be of great help to me.
There's 2 ways to spin the reels. Fake or Real. Fake means you would just show a motion-blur type of movieclip which when it stops, is replaced by the predetermined symbols. The second way is to actually move the 3 or 4 visible symbols, referencing an array so you know which symbol is coming next. When the reel stops, you again replace the currently visible symbols which the winning symbols. So the first thing you'll want to decide is what method to use. I prefer method 2 since it gives a much less cheesy look.
As for wins, you need to have an array of all lines and all posible wins combinations (and pays), then check the winning symbols against each win combination of each played line, and pay accordingly.
pseudobiotic
12-09-2008, 02:01 AM
a note if you're thinking about taking money:
don't calculate wins on the flash side. whoever is doing the random number generator should also determine wins. all the flash client should be trusted to do is present the result. all online casinos have to work that way as flash is totally not-secure
a note if you're thinking about taking money:
don't calculate wins on the flash side. whoever is doing the random number generator should also determine wins. all the flash client should be trusted to do is present the result. all online casinos have to work that way as flash is totally not-secure
Of course, but my understanding was that he's just making a slot machine, not for an online casino, and hence no server side.
laaptu
12-10-2008, 09:27 AM
Thanks fitz and pseudobiotic for your replies.
Ok I develop a reel containing all my symbols and used tween animation to do the reel animation.
But after the tween is complete,I don't know how to reference the values of the movieclip and I also not know how to make my tween stop at the middle of the symbol as it happens in casino slot.
Meaning the tween sometimes stop up and down of the symbols that are in the reel movieclip.
First I have made movieclip for each symbols and then combined them to form a new movieclip named reel.
So dear users how should I move now.
Yours guide will be very much useful.
And this is not a casino online game,I am making it to learn myself Actionscript 3.0 gaming.
The tween shouldn't dictact the value of reel, the value of the reel should dictact the tween.
Yes. Or you should round your y value off to the nearest height of the symbols.
laaptu
12-11-2008, 05:45 AM
Dear fitz i didn't get your explanation,would you please illustrate a little bit.
Thanks fitz and rrh.
Now I am stuck with retrieving the symbols instance name
And I have constructed a reel which is a movie clip consisting of reel symbols which are also movieclip.
And I have placed a bar and used tween animation to move the reel.
I used hitTestObject to find the contact between the bar and the reel like
if(bar1.hitTestObject(reels)
{
trace("hit");
}
Now How can I get the instance name of the symbols that has contacted the bar after the motion tween stop.
I can use reels.coin to find whether the bar has contacted the coin symbol or not.
But I want to get the instance name coin if it has hit the bar.
To implement this what should I do
I really don't understand the method in which you are attempting o do this honestly. At no point should you have to use hitTestObject() for instance. At this point, since I don't really get how you are going about this, I don't think I can be of much help unless you post your project, and even then, I don't know.
You could cycle through all the symbols and test each one until you find one that hits.
But I'm with Fitz, you should go the other direction. Pick a symbol randomly, and then create your tween based on the y position of that symbol.
laaptu
12-12-2008, 03:55 AM
Ok I solved with using dictionary array in which I kept all my reel symbols and used hitTestObject using the array.Then once the object hits the bar,it gives the index of that object.
But I am now stuck with reel animation.If I can do the circular reel animation using tween,then whole my problem is solved.
I just want to use my reel,so that it loops around the slot window.
Do you have any idea on how should I implement this.
And thanks fitz and rrh for your replies.
If you think,you can help with this project,then I would surely post my project codes.
laaptu
12-12-2008, 07:08 AM
package
{
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.events.*;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.geom.Point;
import flash.utils.Timer;
import flash.utils.Dictionary;
public class reels extends MovieClip
{
private var Reels:SpinReel;
private var mask1:mask_reel;
private var mask2:mask_reel;
private var spin_tween:Tween;
private var symb_arr:Dictionary;
private var spin_timer:Timer= new Timer(100,0);
public function reels()
{
add_reels();
btn_spin.addEventListener(MouseEvent.CLICK,spin_re els);
}
private function add_reels():void
{
Reels = new SpinReel();
mask1 = new mask_reel();
Reels.x =160;
mask1.x = 150;
Reels.y= 260;
mask1.y= 80;
addChildAt(Reels,4);
addChildAt(mask1,6);
Reels.mask= mask1;
Reels.cacheAsBitmap =true;
mask1.cacheAsBitmap = true;
mask1.addEventListener(Event.ENTER_FRAME,addMask);
function addMask(evt:Event):void
{
mask1.x=110;
mask1.y = 76;
}
}
private function spin_reels(evt:MouseEvent):void
{
var j:int = Math.random()*300;
spin_tween = new Tween(Reels, "y",Elastic.easeOut , 0, j, 2, true);
spin_tween.addEventListener(TweenEvent.MOTION_CHAN GE, mover);
spin_tween.addEventListener(TweenEvent.MOTION_FINI SH, stopper);
}
private function mover(tevt:TweenEvent):void
{
var i:int = Math.random()*450;
Reels.y = i;
}
private function stopper(tevt:TweenEvent):void
{
trace("Inside stopper");
spin_tween.removeEventListener(TweenEvent.MOTION_S TART, mover);
spin_tween.removeEventListener(TweenEvent.MOTION_F INISH, stopper);
var symb_arr = new Dictionary();
symb_arr = [Reels.g_coin,Reels.s_number,Reels.three_bar,Reels. two_bar,Reels.one_bar,Reels.r_apple];
for (var t:int = 0;t<6;t++)
{
if ( bar1.hitTestObject(symb_arr[t]))
{
trace(symb_arr.indexOf(symb_arr[t]));
trace("hit");
}
}
}
}
}
laaptu
12-12-2008, 07:11 AM
How can I align the symbol at the middle i.e. the symbol that hits the bar.
And I have problem in implementation of first and last symbols.
What to do if the first symbol comes at the middle and last of reel window as symbols above it will be left empty.
And what to do if the last symbol comes at top and middle of the reel window.
Further my reel window can accomodate only 3 symbols at a time.
Please help me on this.
laaptu
12-12-2008, 07:35 AM
Dear users look at it
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.