import GUI
setscreen ("graphics: 340;210")
var background : int := Pic.FileNew ("SlotMachine.jpg")
var pic1 : int := Pic.FileNew ("Banana1.bmp")
var pic2 : int := Pic.FileNew ("Grape.bmp")
var pic3 : int := Pic.FileNew ("Orange.bmp")
var pic4 : int := Pic.FileNew ("Banana1.bmp")
var pic5 : int := Pic.FileNew ("Grape.bmp")
var pic6 : int := Pic.FileNew ("Orange.bmp")
var pic7 : int := Pic.FileNew ("Banana1.bmp")
var pic8 : int := Pic.FileNew ("Grape.bmp")
var pic9 : int := Pic.FileNew ("Orange.bmp")
var square1 : int := Pic.FileNew ("Square.bmp")
var square2 : int := Pic.FileNew ("Square.bmp")
var square3 : int := Pic.FileNew ("Square.bmp")
var q1, q2, q3 : int := 1
var bet, winnings, balance : int := 0
var key : string (1)
var y : array 1 .. 9 of int
var d, e, button, spin, font1 : int
var balance1, bet1, winnings1 : string
var maxbet : boolean := false
balance := 100
for z : 1 .. 9
y (z) := 0
end for
font1 := Font.New ("Sans Serif:14")
View.Set ("offscreenonly")
put "You will receive $100 in your balance."
put "You can bet $1 to $10 by pressing the 'bet one' button or to go directly to $10, press 'bet max'"
put "If you would like to exit prematurly, press esc."
put "Press any key to continue." ..
View.Update
getch (key)
View.Update
proc draw
Pic.Draw (background, 0, 0, picCopy)
Pic.Draw (pic1, 75, 81 + y (1), picUnderMerge)
Pic.Draw (pic2, 62, 200 + y (2), picUnderMerge)
Pic.Draw (pic3, 62, 319 + y (3), picUnderMerge)
Pic.Draw (pic4, 153, 81 + y (4), picUnderMerge)
Pic.Draw (pic5, 142, 200 + y (5), picUnderMerge)
Pic.Draw (pic6, 142, 319 + y (6), picUnderMerge)
Pic.Draw (pic7, 235, 81 + y (7), picUnderMerge)
Pic.Draw (pic8, 224, 200 + y (8), picUnderMerge)
Pic.Draw (pic9, 224, 319 + y (9), picUnderMerge)
Font.Draw (winnings1, 267, 61, font1, 12)
Font.Draw (balance1, 16, 14, font1, 12)
Font.Draw (bet1, 75, 61, font1, 12)
end draw
Pic.SetTransparentColor (background, white)
Pic.Draw (background, 0, 0, picCopy)
loop
spin := 0
loop
Mouse.Where (d, e, button)
Text.Locate (1, 1)
if button = 0 then
balance1 := intstr (balance)
bet1 := intstr (bet)
winnings1 := intstr (winnings)
Pic.Draw (background, 0, 0, picCopy)
Font.Draw (balance1, 16, 13, font1, 12)
Font.Draw (bet1, 75, 61, font1, 12)
Font.Draw (winnings1, 267, 61, font1, 12)
View.Update
else
if d > 94 and d < 137 and e > 24 and e < 51 then
winnings := 0
if bet > 19 then
bet := 20
else
bet := bet + 1
balance := balance - 1
end if
balance1 := intstr (balance)
bet1 := intstr (bet)
winnings1 := intstr (winnings)
cls
Pic.Draw (background, 0, 0, picCopy)
Font.Draw (balance1, 16, 13, font1, 12)
Font.Draw (bet1, 75, 61, font1, 12)
Font.Draw (winnings1, 267, 61, font1, 12)
delay (150)
View.Update
elsif d > 169 and d < 201 and e > 23 and e < 51 then
spin := 1
balance1 := intstr (balance)
bet1 := intstr (bet)
winnings1 := intstr (winnings)
Font.Draw (balance1, 16, 13, font1, 12)
Font.Draw (bet1, 75, 61, font1, 12)
Font.Draw (winnings1, 267, 61, font1, 12)
View.Update
elsif d > 223 and d < 265 and e > 23 and e < 51 and maxbet = false then
winnings := 0
if bet > 20 then
bet := 20
else
bet := 20
balance := balance - 20
end if
balance1 := intstr (balance)
bet1 := intstr (bet)
winnings1 := intstr (winnings)
cls
Pic.Draw (background, 0, 0, picCopy)
Font.Draw (balance1, 16, 14, font1, 12)
Font.Draw (bet1, 75, 61, font1, 12)
Font.Draw (winnings1, 267, 61, font1, 12)
delay (150)
View.Update
maxbet := true
end if
exit when spin > 0
end if
end loop
randint (q1, 50, 70)
randint (q2, 40, 60)
randint (q3, 30, 50)
loop
cls
draw
View.Update
if q1 > 1 then
q1 -= 1
elsif q1 = 1 then
if y (1) <= 10 and y (1) >= 5 then
q1 := 0
elsif y (2) <= -116 and y (2) >= -121 then
q1 := 0
elsif y (3) <= -235 and y (3) >= -240 then
q1 := 0
end if
elsif q1 = 0 then
q1 := 0
else
q1 := 1
end if
if q2 > 1 then
q2 -= 1
elsif q2 = 1 then
if y (4) <= 10 and y (4) >= 5 then
q2 := 0
elsif y (5) <= -116 and y (5) >= -121 then
q2 := 0
elsif y (6) <= -235 and y (6) >= -240 then
q2 := 0
end if
elsif q1 = 0 then
q1 := 0
else
q2 := 1
end if
if q3 > 1 then
q3 -= 1
elsif q3 = 1 then
if y (7) <= 10 and y (7) >= 5 then
q3 := 0
elsif y (8) <= -116 and y (8) >= -121 then
q3 := 0
elsif y (9) <= -235 and y (9) >= -240 then
q3 := 0
end if
elsif q1 = 0 then
q1 := 0
else
q3 := 1
end if
exit when q1 = 0 and q2 = 0 and q3 = 0
y (1) := y (1) - q1
y (2) := y (2) - q1
y (3) := y (3) - q1
y (4) := y (4) - q2
y (5) := y (5) - q2
y (6) := y (6) - q2
y (7) := y (7) - q3
y (8) := y (8) - q3
y (9) := y (9) - q3
delay (20)
if y (3) < -250 and y (1) < -100 then
y (1) := 110
y (2) := 110
end if
if y (3) < -319 then
y (3) := 45
end if
if y (6) < -250 and y (4) < -100 then
y (4) := 110
y (5) := 110
end if
if y (6) < -319 then
y (6) := 45
end if
if y (9) < -250 and y (7) < -100 then
y (7) := 110
y (8) := 110
end if
if y (9) < -319 then
y (9) := 45
end if
exit when q1 = 0 and q2 = 0 and q3 = 0
end loop
if y (1) <= 10 and y (1) >= 5 and y (4) <= 10 and y (4) >= 5 and y (7) <= 10 and y (7) >= 5 then
winnings := bet * 4
elsif y (2) <= -116 and y (2) >= -121 and y (5) <= -116 and y (5) >= -121 and y (8) <= -116 and y (8) >= -121 then
winnings := bet * 3
elsif y (3) <= -235 and y (3) >= -240 and y (6) <= -235 and y (6) >= -240 and y (9) <= -235 and y (9) >= -240 then
winnings := bet * 2
end if
balance := balance + winnings
maxbet := false
spin := 0
bet := 0
balance1 := intstr (balance)
bet1 := intstr (bet)
winnings1 := intstr (winnings)
Pic.Draw (background, 0, 0, picCopy)
Font.Draw (balance1, 16, 14, font1, 12)
Font.Draw (bet1, 75, 61, font1, 12)
Font.Draw (winnings1, 16, 14, font1, 12)
delay (500)
View.Update
end loop
|