scriptController
{
//randomize reels
reel1rnd = floor(random(3))
reel2rnd = floor(random(3))
reel3rnd = floor(random(3))
//stop reel
reel1.image_single = reel1rnd
reel2.image_single = reel2rnd
reel3.image_single = reel3rnd
sound_play(Reel_Stop);
//check for winner
if(win_check()){ sound_play(Coins_In_Tray); }
}
ScriptHandle
{
if (global.spin_enabled = true){
// sound_play(Insert_Coin);
score -= global.spin_cost
image_single = -1
//disable spin button
global.spin_enabled = false
//start reel animation
sound_play(Reel_Spin);
reel1.image_single = -1
reel2.image_single = -1
reel3.image_single = -1
//set alarm0 on controller
with(controller){
alarm[0] = room_speed*global.spin_duration
alarm[1] = room_speed*global.spin_duration + 0.5
}
}
}
winCheck
if (reel1rnd == 0 && reel2rnd == 0 && reel3rnd == 0){score += 1000; return true;}
if (reel1rnd == 1 && reel2rnd == 1 && reel3rnd == 1){score += 500; return true;}
if (reel1rnd == 2 && reel2rnd == 2 && reel3rnd == 2){score += 200; return true;}
if (reel1rnd == 1 && reel2rnd == 1 && reel3rnd != 1){score += 100; return true;}
if (reel1rnd == 2 && reel2rnd == 2 && reel3rnd != 2){score += 100; return true;}
return false;
Solid: false
Visible: false
Depth: 0
Persistent: false
Parent:
Children:
Mask:
execute script scriptController with arguments (0,0,0,0,0)
execute code:
{
//checks if you can pay to play
if (score = 0){
str = show_question('play again?')
if (str == false){game_end()}
if (str == true){game_restart()}
}
global.spin_enabled = true
}execute code:
{
global.spin_enabled = true
global.spin_duration = 1
global.spin_cost = 25
score = 1000 }
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
execute code:
{
image_single = 0 }
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
execute code:
{
image_single = 0 }
Information about object: reel3
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
execute code:
{
image_single = 0
}Information about object: objHandleSprite: Handle
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask: No Physics ObjectCreate Event:execute code: { image_single = 0 image_speed = 0.25 }Mouse Event for Left Button:execute code: if (not sound_isplaying(Coins_In_Tray)) { Handle() }Other Event: Animation End:execute code: { image_single = 0 }
No comments:
Post a Comment