
-----------------------------------
toddbaldwin1
Mon Jun 05, 2017 1:03 pm

Stuck Slot machine code
-----------------------------------
I have a final project that i have to make a slot machine and I know how to make all the pictures for my reels turn and pick a random one but idk how to get it to spin first,


    locate (15, 10)
    put "Press any button to spin the wheels: " ..
    locate (8, 10)
    put "Money: ", coin ..
end setup

procedure playerChoice (var gameover : string)
    var input : string (1)
     if input = "q" then
    else
        coin := coin - 1
    end if

end playerChoice

procedure spinWheels
    wheel1 := Rand.Int (1, 3)
    wheel2 := Rand.Int (1, 3)
    wheel3 := Rand.Int (1, 3)

    if wheel1 = 1 then
        Draw.MapleLeaf (90, 200, 170, 250, brightred)
        Draw.FillMapleLeaf (90, 200, 170, 250, brightred)
    elsif wheel1 = 2 then
        Draw.Star (90, 200, 170, 250, yellow)
        Draw.FillStar (90, 200, 170, 250, yellow)
    elsif wheel1 = 3 then
        Draw.Box (340, 200, 280, 250, brightblue)
        Draw.FillBox (340, 200, 280, 250, brightblue)
    end if

    if wheel2 = 1 then
        Draw.MapleLeaf (180, 200, 260, 250, brightred)
        Draw.FillMapleLeaf (180, 200, 260, 250, brightred)
    elsif wheel2 = 2 then
        Draw.Star (180, 200, 260, 250, yellow)
        Draw.FillStar (180, 200, 260, 250, yellow)
    elsif wheel2 = 3 then
        Draw.Box (190, 200, 250, 250, brightblue)
        Draw.FillBox (190, 200, 250, 250, brightblue)
    end if

    if wheel3 = 1 then
        Draw.MapleLeaf (351, 200, 269, 250, brightred)
        Draw.FillMapleLeaf (351, 200, 269, 250, brightred)
    elsif wheel3 = 2 then
        Draw.Star (351, 200, 269, 250, yellow)
        Draw.FillStar (351, 200, 269, 250, yellow)
    elsif wheel3 = 3 then
        Draw.Box (103, 200, 162, 250, brightblue)
        Draw.FillBox (103, 200, 162, 250, brightblue)
        delay (100)
    end if

end spinWheels

% MAIN PROGRAM
setup
loop
    playerChoice (gameover)
    exit when gameover = "yes"
    spinWheels
end loop
