Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Turing Help-baseball game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Super




PostPosted: Sat Jan 17, 2004 11:20 pm   Post subject: Turing Help-baseball game

I have to create a baseball game program. I am done most of it. I have one major problem: when the user finishes facing a batter, they should be able to go to a congratulatory screen (if the user strikes him out) OR another screen if they walk him or hit him. From there, they should be able to go back to the main menu and have the choice of either playing the game again or exitting the program. However, when a user decides to play again, it skips the game portion and goes straight to the Congratulatory screen or the other screen. I HAVE TO use GUI. THe part where it leads to the Congratulatory screen or the other "bad" screen is near the bottom of the fastballScreen procedure. HELP!


[%GUI Importation
import GUI in "%oot/lib/GUI"

%Variable Declaration
var font1, font2, font3, font4, font5, font6 : int
var draw : int := 0
var draw2 : int := 0
var draw3 : int := 0
var draw4 : int := 0
var draw5 : int := 0
var draw6 : int := 0
var draw7 : int := 0
var draw8 : int := 0
var draw9 : int := 0
var strikes : int := 0
var balls : int := 0
var x11, y11, x21, y21, xmouse1, ymouse1, button1 : int
var randomspeed : int
var randomspeed2 : int

%Font Specification
font1 := Font.New ("Mistral:12:bold")
assert font1 > 0
font2 := Font.New ("Edwardian Script ITC:25:bold underline")
assert font2 > 0
font3 := Font.New ("Lucida Console:10:bold")
assert font3 > 0
font4 := Font.New ("Mistral:20:Bold underline")
assert font4 > 0
font5 := Font.New ("Lucida Console:10:bold italic")
assert font4 > 0
font6 := Font.New ("Rockwell:10:bold")
assert font6 > 0

%Picture Declarations
procedure picture
Pic.ScreenLoad ("2.bmp", 0, 0, picCopy)
end picture

procedure picture2
Pic.ScreenLoad ("1.bmp", 0, 0, picCopy)
end picture2

procedure picture3
Pic.ScreenLoad ("bottomborder.bmp", 0, 0, picCopy)
end picture3

procedure picture4
Pic.ScreenLoad ("batter1.bmp", 140, 75, picCopy)
end picture4

procedure picture5
Pic.ScreenLoad ("glove.bmp", 540, 80, picCopy)
end picture5

procedure picture6
Pic.ScreenLoad ("fastball.bmp", 0, 100, picCopy)
end picture6

procedure picture7
Pic.ScreenLoad ("fastball.bmp", 0, 200, picCopy)
end picture7

procedure picture8
Pic.ScreenLoad ("fastball.bmp", 0, 300, picCopy)
end picture8

procedure picture9
Pic.ScreenLoad ("backwardfastball.bmp", 550, 100, picCopy)
end picture9

procedure picture10
Pic.ScreenLoad ("backwardfastball.bmp", 550, 200, picCopy)
end picture10

procedure picture11
Pic.ScreenLoad ("backwardfastball.bmp", 550, 300, picCopy)
end picture11

procedure picture12
Pic.ScreenLoad ("insideofbaseball.bmp", 250, 70, picCopy)
end picture12

procedure picture13
Pic.ScreenLoad ("fastballscreen.bmp", 160, 100, picCopy)
end picture13

procedure picture14
Pic.ScreenLoad ("strikescreen.bmp", 160, 98, picCopy)
end picture14

procedure picture15
Pic.ScreenLoad ("balloutside.bmp", 160, 98, picCopy)
end picture15

procedure picture16
Pic.ScreenLoad ("ballhigh.bmp", 160, 98, picCopy)
end picture16

procedure picture17
Pic.ScreenLoad ("balllow.bmp", 160, 98, picCopy)
end picture17

procedure picture18
Pic.ScreenLoad ("ballin.bmp", 160, 98, picCopy)
end picture18

procedure picture19
Pic.ScreenLoad ("hitbatter.bmp", 160, 98, picCopy)
end picture19

procedure picture20
Pic.ScreenLoad ("strikeoutresult.bmp", 160, 98, picCopy)
end picture20
%----------------------------------------------------------
%Disablement of Buttons
procedure disablebutton1and2
GUI.Disable (draw)
GUI.Disable (draw2)
GUI.Hide (draw)
GUI.Hide (draw2)
end disablebutton1and2

procedure disablebutton2to9
GUI.Disable (draw2)
GUI.Disable (draw3)
GUI.Disable (draw4)
GUI.Disable (draw5)
GUI.Disable (draw6)
GUI.Disable (draw7)
GUI.Disable (draw8)
GUI.Disable (draw9)
end disablebutton2to9

procedure disable1to4and6to9
GUI.Disable (draw)
GUI.Disable (draw2)
GUI.Disable (draw3)
GUI.Disable (draw4)
GUI.Disable (draw6)
GUI.Disable (draw7)
GUI.Disable (draw8)
GUI.Disable (draw9)
drawfillbox (310, 70, 370, 100, 7)
end disable1to4and6to9




%Title
procedure title
cls
drawfillbox (0, 0, 639, 399, 7)
Font.Draw ("Bullpen Blast", 250, 370, font4, 12)
picture3
end title

%-----------------------------------+++++++++------------------------
%Goodbye Screen
procedure goodBye
title
locate (12, 30)
color (12)
colorback (7)
put "Thanks for playing!"
end goodBye

%Results of Game
procedure strikeoutresult
title
color (12)
put "NADIM STRUCK HIM OUT!"
GUI.Show (draw9)
GUI.Enable (draw9)

end strikeoutresult

procedure walkresult
title
put "BOO"
color (12)

GUI.Show (draw9)
GUI.Enable (draw9)
end walkresult

procedure hitBatter
title
color (12)
put "hit batter"
GUI.Show (draw9)
GUI.Enable (draw9)
end hitBatter

%Game using fastball

procedure fastballScreen
title
picture13
x11 := 300
x21 := 392
y11 := 200
y21 := 275
% drawbox (x11, y11, x21, y21, 12)
% drawbox (330, 230, 350, 255, 14)
% drawbox (300, 255, 365, 275, 12)
% drawbox (300, 230, 330, 255, 9)
% drawbox (300, 200, 375, 230, 12)
% drawbox (350, 230, 370, 255, 14)
% drawbox (365, 255, 375, 268, 9)
% drawbox (375, 200, 392, 213, 12)
% %----
% drawbox (375, 213, 392, 275, 12)
% drawbox (365, 268, 375, 275, 9)
% drawbox (370, 230, 375, 255, 100)
%-----

color (12)
colorback (7)
locate (4, 67)
put "Strikes"
locate (7, 68)
put "Balls"
locate (10, 66)
put "Pitch Speed"

loop
setscreen("offscreenonly")


var strikes : int := 0
var balls : int := 0
var randomspeed : int
var draw9 : int := 0
loop

mousewhere (xmouse1, ymouse1, button1)

if (xmouse1 >= 330 and xmouse1 <= 350) and (ymouse1 >= 230 and ymouse1 <= 255) and button1 = 1 then
strikes := strikes + 1
for x : 1 .. 10
picture13
drawfilloval (310 + x * 3, 250 - x, 3, 3, 31)
delay (10)
drawfilloval (310 + x * 3, 250 - x, 2, 2, 42)

color (12)
colorback (7)

locate (5, 70)
put strikes
end for

randomize
randint (randomspeed, 75, 100)
locate (11, 70)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed
color (12)
locate (20, 20)
put "NICE PITCH!"
delay (2000)
color (7)
locate (20, 20)
put "NICE PITCH!"

if randomspeed > 94 then
locate (20, 20)
color (12)
put "You're really bringing the heat tonight!"
delay (1500)
color (7)
locate (20, 20)
put "You're really bringing the heat tonight!"
elsif randomspeed < 80 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
end if
picture14
delay (1000)

picture13

elsif xmouse1 >= 300 and xmouse1 <= 365 and ymouse1 >= 255 and ymouse1 <= 275 and button1 = 1 then
balls := balls + 1
for x : 1 .. 35
picture13
drawfilloval (310 + x, 260, 3, 3, 31)
delay (3)
drawfilloval (310 + x, 260, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for

randomize
randint (randomspeed, 75, 85)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "TOO HIGH!"
delay (2000)
color (7)
locate (20, 20)
put "TOO HIGH!"

if randomspeed < 80 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
end if
picture16
delay (1000)
picture13

elsif xmouse1 >= 300 and xmouse1 <= 330 and ymouse1 >= 230 and ymouse1 <= 255 and button1 = 1 then
balls := balls + 1
for x : 1 .. 5
picture13
drawfilloval (310 + x * 3, 245, 3, 3, 31)
delay (40)
drawfilloval (310 + x * 3, 245, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for

randomize
randint (randomspeed, 75, 90)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "TOO FAR OUTSIDE!"
delay (2000)
color (7)
locate (20, 20)
put "TOO FAR OUTSIDE!"

if randomspeed < 80 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
end if
picture15
delay (1000)
picture13

elsif xmouse1 >= 300 and xmouse1 <= 375 and ymouse1 >= 200 and ymouse1 <= 230 and button1 = 1 then
balls := balls + 1
for x : 1 .. 30
picture13
drawfilloval (310 + x, 245 - x, 3, 3, 31)
delay (6)
drawfilloval (310 + x, 245 - x, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for

randomize
randint (randomspeed, 75, 90)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "TOO LOW!"
delay (2000)
color (7)
locate (20, 20)
put "TOO LOW!"

if randomspeed < 80 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
end if
picture17
delay (1000)
picture13


elsif xmouse1 >= 350 and xmouse1 <= 370 and ymouse1 >= 230 and ymouse1 <= 255 and button1 = 1 then
balls := balls + 1
for x : 1 .. 55
picture13
drawfilloval (310 + x, 245, 3, 3, 31)
delay (1)
drawfilloval (310 + x, 245, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for

randomize
randint (randomspeed, 75, 95)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "TOO FAR INSIDE!"
delay (2000)
color (7)
locate (20, 20)
put "TOO FAR INSIDE!"
if randomspeed > 94 then
locate (20, 20)
color (12)
put "You're throwing some fireballs tonight!"
delay (1500)
color (7)
locate (20, 20)
put "You're throwing some fireballs tonight!"
elsif randomspeed < 80 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
end if
picture18
delay (1000)
picture13

elsif xmouse1 >= 365 and xmouse1 <= 375 and ymouse1 >= 255 and ymouse1 <= 268 and button1 = 1 then
balls := balls + 1
for x : 1 .. 62
picture13
drawfilloval (310 + x, 260, 3, 3, 31)
delay (4)
drawfilloval (310 + x, 260, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for

randomize
randint (randomspeed, 75, 90)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "WAY TOO FAR INSIDE! CAREFUL, YOU ALMOST HIT THE BATTER!"
delay (2000)
color (7)
locate (20, 20)
put "WAY TOO FAR INSIDE! CAREFUL, YOU ALMOST HIT THE BATTER!"
if randomspeed < 80 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
end if
picture18
delay (1000)
picture13

elsif xmouse1 >= 375 and xmouse1 <= 392 and ymouse1 >= 200 and ymouse1 <= 213 and button1 = 1 then
balls := balls + 1
for x : 1 .. 62
picture13
drawfilloval (310 + x, 260 - x div 1.5, 3, 3, 31)
delay (1)
drawfilloval (310 + x, 260 - x div 1.5, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for

randomize
randint (randomspeed, 75, 100)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "TOO LOW AND INSIDE! CAREFUL, YOU ALMOST HIT THE BATTER!"
delay (2000)
color (7)
locate (20, 20)
put "TOO LOW AND INSIDE! CAREFUL, YOU ALMOST HIT THE BATTER!"
if randomspeed > 94 then
locate (20, 20)
color (12)
put "That 2-seamer was blazing!"
delay (1500)
color (7)
locate (20, 20)
put "That 2-seamer was blazing!"
elsif randomspeed < 80 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
end if
picture18
delay (1000)
picture13

else
if xmouse1 >= 375 and xmouse1 <= 392 and ymouse1 >= 213 and ymouse1 <= 275 and button1 = 1 or
xmouse1 >= 365 and xmouse1 <= 375 and ymouse1 >= 230 and ymouse1 <= 255 and button1 = 1 or
xmouse1 >= 370 and xmouse1 <= 375 and ymouse1 >= 230 and ymouse1 >= 255 and button1 = 1 then
for x : 1 .. 70
picture13
drawfilloval (310 + x, 260, 3, 3, 31)
delay (1)
drawfilloval (310 + x, 260, 2, 2, 42)

color (12)
colorback (7)

end for

randomize
randint (randomspeed, 75, 100)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "YOU HIT THE BATTER! GAME OVER!"
delay (2000)
color (7)
locate (20, 20)
put "YOU HIT THE BATTER! GAME OVER!"

picture19
delay (1000)
picture13
exit
end if
end if

exit when strikes =3 or balls=4

end loop
Arrow if strikes = 3 then
strikeoutresult
end if
if

balls = 4 then
walkresult
end if

if xmouse1 >= 375 and xmouse1 <= 392 and ymouse1 >= 213 and ymouse1 <= 275 and button1 = 1 or
xmouse1 >= 365 and xmouse1 <= 375 and ymouse1 >= 230 and ymouse1 <= 255 and button1 = 1 or
xmouse1 >= 370 and xmouse1 <= 375 and ymouse1 >= 230 and ymouse1 >= 255 and button1 = 1 then
hitBatter

end if

end loop


end fastballScreen
procedure sinkerScreen
title
disable1to4and6to9
picture13
x11 := 300
x21 := 392
y11 := 200
y21 := 275
% drawbox (x11, y11, x21, y21, 12)
% drawbox (330, 230, 350, 255, 14)
% drawbox (300, 255, 365, 275, 12)
% drawbox (300, 230, 330, 255, 9)
% drawbox (300, 200, 375, 230, 12)
% drawbox (350, 230, 370, 255, 14)
% drawbox (365, 255, 375, 268, 9)
% drawbox (375, 200, 392, 213, 12)
% %----
% drawbox (375, 213, 392, 275, 12)
% drawbox (365, 268, 375, 275, 9)
% drawbox (370, 230, 375, 255, 100)
%-----

color (12)
colorback (7)
locate (4, 67)
put "Strikes"
locate (7, 68)
put "Balls"
locate (10, 66)
put "Pitch Speed"

loop

mousewhere (xmouse1, ymouse1, button1)

if (xmouse1 >= 330 and xmouse1 <= 350) and (ymouse1 >= 230 and ymouse1 <= 255) and button1 = 1 then
strikes := strikes + 1
for x : 1 .. 10
picture13
drawfilloval (310 + x * 3, 250 - x, 3, 3, 31)
delay (10)
drawfilloval (310 + x * 3, 250 - x, 2, 2, 42)


end for

for x : 1 .. 10
drawfilloval (340, 240 - x, 2, 2, 31)
delay (10)
drawfilloval (340, 240 - x, 2, 2, 42)
drawfilloval (340, 230, 2, 2, 31)
color (12)
colorback (7)

locate (5, 70)
put strikes
end for
randomize
randint (randomspeed, 75, 90)
locate (11, 70)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed
color (12)
locate (20, 20)
put "NICE PITCH!"
delay (2000)
color (7)
locate (20, 20)
put "NICE PITCH!"

if randomspeed > 80 then
locate (20, 20)
color (12)
put "You're really bringing the heat tonight!"
delay (1500)
color (7)
locate (20, 20)
put "You're really bringing the heat tonight!"
elsif randomspeed < 70 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A SINKER? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A SINKER? THROW HARDER!"
end if
picture14
delay (1000)

picture13

elsif xmouse1 >= 300 and xmouse1 <= 365 and ymouse1 >= 255 and ymouse1 <= 275 and button1 = 1 then
balls := balls + 1
for x : 1 .. 35
picture13
drawfilloval (310 + x, 260, 3, 3, 31)
delay (3)
drawfilloval (310 + x, 260, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for

for x : 1 .. 10
drawfilloval (345, 260 - x, 3, 3, 31)
delay (3)
drawfilloval (345, 260 - x, 2, 2, 42)
color (12)
colorback (7)

locate (8, 70)
put balls
end for

randomize
randint (randomspeed, 75, 85)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "TOO HIGH!"
delay (2000)
color (7)
locate (20, 20)
put "TOO HIGH!"

if randomspeed < 80 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A SINKER? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A SINKER? THROW HARDER!"
end if
picture16
delay (1000)
picture13

elsif xmouse1 >= 300 and xmouse1 <= 330 and ymouse1 >= 230 and ymouse1 <= 255 and button1 = 1 then
balls := balls + 1
for x : 1 .. 5
picture13
drawfilloval (310 + x * 3, 245, 3, 3, 31)
delay (40)
drawfilloval (310 + x * 3, 245, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for

for x : 1 .. 10
drawfilloval (325, 245 - x, 3, 3, 31)
delay (40)
drawfilloval (325, 245 - x, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for
randomize
randint (randomspeed, 75, 90)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "TOO FAR OUTSIDE!"
delay (2000)
color (7)
locate (20, 20)
put "TOO FAR OUTSIDE!"

if randomspeed < 80 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A FAST BALL? THROW HARDER!"
end if
picture15
delay (1000)
picture13

elsif xmouse1 >= 300 and xmouse1 <= 375 and ymouse1 >= 200 and ymouse1 <= 230 and button1 = 1 then
balls := balls + 1
for x : 1 .. 30
picture13
drawfilloval (310 + x, 245 - x, 3, 3, 31)
delay (6)
drawfilloval (310 + x, 245 - x, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for
for x : 1 .. 10
picture13
drawfilloval (340, 215 - x, 3, 3, 31)
delay (6)
drawfilloval (340, 215 - x, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for
randomize
randint (randomspeed, 75, 90)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "TOO LOW!"
delay (2000)
color (7)
locate (20, 20)
put "TOO LOW!"

if randomspeed < 80 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A SINKER? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A SINKER? THROW HARDER!"
end if
picture17
delay (1000)
picture13


elsif xmouse1 >= 350 and xmouse1 <= 370 and ymouse1 >= 230 and ymouse1 <= 255 and button1 = 1 then
balls := balls + 1
for x : 1 .. 55
picture13
drawfilloval (310 + x, 245, 3, 3, 31)
delay (1)
drawfilloval (310 + x, 245, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for
for x : 1 .. 10
picture13
drawfilloval (365, 245 - x, 3, 3, 31)
delay (1)
drawfilloval (365, 245 - x, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for

randomize
randint (randomspeed, 75, 90)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "TOO FAR INSIDE!"
delay (2000)
color (7)
locate (20, 20)
put "TOO FAR INSIDE!"
if randomspeed > 985 then
locate (20, 20)
color (12)
put "You're throwing some fireballs tonight!"
delay (1500)
color (7)
locate (20, 20)
put "You're throwing some fireballs tonight!"
elsif randomspeed < 80 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A SINKER? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A SINKER? THROW HARDER!"
end if
picture18
delay (1000)
picture13

elsif xmouse1 >= 365 and xmouse1 <= 375 and ymouse1 >= 255 and ymouse1 <= 268 and button1 = 1 then
balls := balls + 1
for x : 1 .. 62
picture13
drawfilloval (310 + x, 260, 3, 3, 31)
delay (4)
drawfilloval (310 + x, 260, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for

for x : 1 .. 10
picture13
drawfilloval (372, 260 - x, 3, 3, 31)
delay (4)
drawfilloval (372, 260 - x, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for

randomize
randint (randomspeed, 75, 90)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "WAY TOO FAR INSIDE! CAREFUL, YOU ALMOST HIT THE BATTER!"
delay (2000)
color (7)
locate (20, 20)
put "WAY TOO FAR INSIDE! CAREFUL, YOU ALMOST HIT THE BATTER!"
if randomspeed < 80 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A SINKER? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A SINKER? THROW HARDER!"
end if
picture18
delay (1000)
picture13

elsif xmouse1 >= 375 and xmouse1 <= 392 and ymouse1 >= 200 and ymouse1 <= 213 and button1 = 1 then
balls := balls + 1
for x : 1 .. 62
picture13
drawfilloval (310 + x, 260 - x div 1.5, 3, 3, 31)
delay (1)
drawfilloval (310 + x, 260 - x div 1.5, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for
for x : 1 .. 10
picture13
drawfilloval (372, 219 - x, 3, 3, 31)
delay (1)
drawfilloval (372, 219 - x, 2, 2, 42)

color (12)
colorback (7)

locate (8, 70)
put balls
end for

randomize
randint (randomspeed, 75, 90)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "TOO LOW AND INSIDE! CAREFUL, YOU ALMOST HIT THE BATTER!"
delay (2000)
color (7)
locate (20, 20)
put "TOO LOW AND INSIDE! CAREFUL, YOU ALMOST HIT THE BATTER!"
if randomspeed > 85 then
locate (20, 20)
color (12)
put "That 4-seamer was blazing!"
delay (1500)
color (7)
locate (20, 20)
put "That 4-seamer was blazing!"
elsif randomspeed < 80 then
locate (20, 20)
color (12)
put "COME ON! YOU CALL THAT A SINKER? THROW HARDER!"
delay (1500)
locate (20, 20)
color (7)
put "COME ON! YOU CALL THAT A SINKER? THROW HARDER!"
end if
picture18
delay (1000)
picture13

else
if xmouse1 >= 375 and xmouse1 <= 392 and ymouse1 >= 213 and ymouse1 <= 275 and button1 = 1 or
xmouse1 >= 365 and xmouse1 <= 375 and ymouse1 >= 230 and ymouse1 <= 255 and button1 = 1 or
xmouse1 >= 370 and xmouse1 <= 375 and ymouse1 >= 230 and ymouse1 >= 255 and button1 = 1 then
for x : 1 .. 70
picture13
drawfilloval (310 + x, 260, 3, 3, 31)
delay (1)
drawfilloval (310 + x, 260, 2, 2, 42)

color (12)
colorback (7)

end for
for x : 1 .. 10
picture13
drawfilloval (380, 260 - x, 3, 3, 31)
delay (1)
drawfilloval (380, 260 - x, 2, 2, 42)

color (12)
colorback (7)

end for

randomize
randint (randomspeed, 75, 90)
locate (11, 70)
color (12)
put randomspeed
delay (1500)
color (7)
locate (11, 70)
put randomspeed

locate (20, 20)
color (12)
put "YOU HIT THE BATTER! GAME OVER!"
delay (2000)
color (7)
locate (20, 20)
put "YOU HIT THE BATTER! GAME OVER!"

picture19
delay (1000)
picture13
exit
end if
end if
if strikes = 3 then
strikeoutresult
else
if balls = 4 then
walkresult
end if
end if
end loop

end sinkerScreen

if strikes = 3 then
strikeoutresult
else
if balls = 4 then
walkresult
end if
end if

procedure userInput
title
Font.Draw ("Please choose the pitch you would like to use:", 120, 336, font6, 14)
picture6
picture7
picture8
picture9
picture10
picture11
picture12
GUI.Enable (draw4)
GUI.Enable (draw5)
GUI.Enable (draw7)
GUI.Show (draw4)
GUI.Show (draw5)
GUI.Show (draw7)

end userInput

procedure batter1
title
picture4
delay (2000)
picture5
Font.Draw ("Click on the glove if", 505, 170, font6, 14)
Font.Draw ("you think you're ready.", 493, 150, font6, 14)

setscreen ("graphics:vga")
var x1, y1, x2, y2, xmouse, ymouse, button : int
x1 := 543
x2 := 590
y1 := 87
y2 := 130
drawbox (x1, y1, x2, y2, 7)
loop
mousewhere (xmouse, ymouse, button)
exit when xmouse >= x1 and xmouse <= x2 and ymouse >= y1 and ymouse <= y2 and button = 1
end loop
userInput
end batter1
procedure mainMenu
title
GUI.Enable (draw7)
GUI.Enable (draw8)
GUI.Show (draw7)
GUI.Show (draw8)
end mainMenu
procedure introduction2
disablebutton1and2
drawfillbox (0, 65, 250, 100, 7)
delay (1000)
Font.Draw ("T", 150, 170, font5, 12)
delay (200)
Font.Draw ("h", 158, 170, font5, 12)
delay (200)
Font.Draw ("e", 166, 170, font5, 12)
delay (200)
Font.Draw ("n", 174, 170, font5, 12)
delay (200)
Font.Draw ("l", 192, 170, font5, 12)
delay (200)
Font.Draw ("e", 200, 170, font5, 12)
delay (200)
Font.Draw ("t", 208, 170, font5, 12)
delay (200)
Font.Draw ("'", 214, 170, font5, 12)
delay (200)
Font.Draw ("s", 222, 170, font5, 12)
delay (200)
Font.Draw ("g", 240, 170, font5, 12)
delay (200)
Font.Draw ("e", 248, 170, font5, 12)
delay (200)
Font.Draw ("t", 256, 170, font5, 12)
delay (200)
Font.Draw ("r", 272, 170, font5, 12)
delay (200)
Font.Draw ("e", 280, 170, font5, 12)
delay (200)
Font.Draw ("a", 288, 170, font5, 12)
delay (200)
Font.Draw ("d", 296, 170, font5, 12)
delay (200)
Font.Draw ("y", 304, 170, font5, 12)
delay (200)
Font.Draw ("f", 322, 170, font5, 12)
delay (200)
Font.Draw ("o", 330, 170, font5, 12)
delay (200)
Font.Draw ("r", 338, 170, font5, 12)
delay (200)
Font.Draw ("s", 350, 170, font5, 12)
delay (200)
Font.Draw ("o", 357, 170, font5, 12)
delay (200)
Font.Draw ("m", 366, 170, font5, 12)
delay (200)
Font.Draw ("e", 374, 170, font5, 12)
delay (200)
Font.Draw ("b", 388, 170, font5, 12)
delay (200)
Font.Draw ("a", 396, 170, font5, 12)
delay (200)
Font.Draw ("s", 403, 170, font5, 12)
delay (200)
Font.Draw ("e", 411, 170, font5, 12)
delay (200)
Font.Draw ("b", 419, 170, font5, 12)
delay (200)
Font.Draw ("a", 427, 170, font5, 12)
delay (200)
Font.Draw ("l", 435, 170, font5, 12)
delay (200)
Font.Draw ("l", 443, 170, font5, 12)
delay (2000)
GUI.Enable (draw3)
GUI.Show (draw3)

end introduction2



procedure introduction1

title
locate (5, 1)
colourback (7)
colour (12)
put
"In this program you will act as the closer in a tied baseball game. It is the bottom of the ninth. The game is 1-0 for your team. Your team's bullpen managed to get through the top two of the eight. Bottom of the ninth, only one batter left."
GUI.Enable (draw2)
GUI.Show (draw2)
end introduction1
%Musicament
process loadingMusic
for x : 1 .. 1
play ("<aaaa>>aaaa<aaaa>bbbb<dddd>cccc2d4d<b4c4c4cb4c4c4cb4d4d4db4d4d4dbe4e4eb4e4e4eb4f4f4fb4f4f4fb4g4g4gb4g4g4g>b16a16a16ab16a16a16ab16c16c16cbcbdbdbebebfbfbgb1g<<1g1g")
play ("5.5P2b2b1b1b8a8b8c8d8e8f8g8g8f8e8d8c8b8a8b8c8d8e8f8g8g")
play (">>>1b1b1b<<<<<28P1a1a1a1a1a1a")
end for
loop
play ("abacadaeafagbcbdbebfbgcdcecfcg1dedfdg4efegfggfgefegdfdedgcfce1cdcgcfbebdbc4bgafaead1acabaa4bacadaeafagbcbdbebfbgcdcecfcgdedfdgefegfggfgefegdfdedgcfcecdcgcfbebdbcbgafaeadacaba")
end loop
end loadingMusic

fork loadingMusic

procedure loadingScreen
disablebutton2to9

%Screen Mode
setscreen ("noecho")
setscreen ("nocursor")

picture
delay (1000)

%Phrase at top of picture
Font.Draw ("Baseball at its best", 218, 310, font2, 14)
delay (2000)

picture2

%Outlines for picture
for x : 1 .. 300
drawline (130, 60 + x, 130, 60 + x, 14)
delay (1)
drawline (130, 60 + x, 130, 60 + x, 14)
end for

for x : 1 .. 367
drawline (130 + x, 360, 130 + x, 360, 14)
delay (1)
drawline (130 + x, 360, 130 + x, 360, 14)
end for

for x : 1 .. 300
drawline (497, 360 - x, 497, 360 - x, 14)
delay (1)
drawline (497, 360 - x, 497, 360 - x, 14)
end for

for x : 1 .. 375
drawline (497 - x, 60, 497 - x, 60, 14)
delay (1)
drawline (497 - x, 60, 497 - x, 60, 14)
end for

for x : 1 .. 310
drawline (117, 59 + x, 122, 59 + x, 14)
delay (1)
drawline (117, 59 + x, 122, 59 + x, 14)
end for

for x : 1 .. 395
drawline (116 + x, 365, 116 + x, 370, 14)
delay (1)
drawline (116 + x, 365, 116 + x, 370, 14)
end for

for x : 1 .. 305
drawline (506, 365 - x, 511, 365 - x, 14)
delay (1)
drawline (506, 365 - x, 511, 365 - x, 14)
end for

for x : 1 .. 10
drawline (506 - x, 60, 506 - x, 60, 14)
delay (1)
drawline (506 - x, 60, 506 - x, 60, 14)
end for
%--------------------------------------------------------
%Loading Bar

for x : 1 .. 60
drawline (175 + x, 83, 175 + x, 99, 12)
delay (50)
drawline (175 + x, 83, 175 + x, 99, 12)
end for

Font.Draw ("20%", 145, 45, font3, 14)

for x : 1 .. 60
drawline (235 + x, 83, 235 + x, 99, 12)
delay (50)
drawline (235 + x, 83, 235 + x, 99, 12)
end for

Font.Draw ("20%", 145, 45, font3, 7)
Font.Draw ("40%", 145, 45, font3, 14)

for x : 1 .. 60
drawline (295 + x, 83, 295 + x, 99, 12)
delay (50)
drawline (295 + x, 83, 295 + x, 99, 12)
end for

Font.Draw ("40%", 145, 45, font3, 7)
Font.Draw ("65%", 145, 45, font3, 14)

for x : 1 .. 60
drawline (355 + x, 83, 355 + x, 99, 12)
delay (50)
drawline (355 + x, 83, 355 + x, 99, 12)
end for

Font.Draw ("65%", 145, 45, font3, 7)
Font.Draw ("90%", 145, 45, font3, 14)

for x : 1 .. 50
drawline (405 + x, 83, 405 + x, 99, 12)
delay (50)
drawline (405 + x, 83, 405 + x, 99, 12)
end for

Font.Draw ("90%", 145, 45, font3, 7)
Font.Draw ("Complete", 145, 45, font3, 14)
delay (250)
Font.Draw ("Complete", 145, 45, font3, 7)
delay (250)
Font.Draw ("Complete", 145, 45, font3, 14)
delay (250)
Font.Draw ("Complete", 145, 45, font3, 7)
delay (250)
Font.Draw ("Complete", 145, 45, font3, 14)
delay (250)
Font.Draw ("Complete", 145, 45, font3, 7)
delay (250)
Font.Draw ("Complete", 145, 45, font3, 14)
delay (250)
Font.Draw ("Complete", 145, 45, font3, 7)
delay (250)
Font.Draw ("Complete", 145, 45, font3, 14)
delay (250)
Font.Draw ("Complete", 145, 45, font3, 7)

drawfillbox (175, 83, 455, 99, 64)
delay (500)
drawfillbox (175, 83, 455, 99, 12)
delay (500)
drawfillbox (175, 83, 455, 99, 64)
delay (500)
drawfillbox (175, 83, 455, 99, 12)
delay (500)
drawfillbox (175, 83, 455, 99, 64)
delay (500)
drawfillbox (175, 83, 455, 99, 12)
delay (500)
drawfillbox (175, 83, 455, 99, 64)

for x : 1 .. 100
drawfillbox (175, 83, 455, 99, x)
delay (20)
end for

drawfillbox (175, 83, 455, 99, 12)

Font.Draw ("ARE YOU READY ?", 260, 30, font1, 12)
delay (500)
Font.Draw ("ARE YOU READY ?", 260, 30, font1, 7)
delay (500)
Font.Draw ("ARE YOU READY ?", 260, 30, font1, 12)
delay (500)
Font.Draw ("ARE YOU READY ?", 260, 30, font1, 7)
delay (500)
Font.Draw ("ARE YOU READY ?", 260, 30, font1, 12)
delay (500)
Font.Draw ("ARE YOU READY ?", 260, 30, font1, 7)
delay (2000)
GUI.Show (draw)
end loadingScreen

draw := GUI.CreateButtonFull (0, 70, 0, "Continue",
introduction1, 0, '^D', false)
draw2 := GUI.CreateButtonFull (70, 70, 0, "Enter BULLPEN BLAST",
introduction2, 0, '^D', false)
draw3 := GUI.CreateButtonFull (300, 70, 0, "Play Ball!",
mainMenu, 0, '^D', false)
draw4 := GUI.CreateButtonFull (300, 250, 0, "Fastball",
fastballScreen, 0, '^F', false)
draw5 := GUI.CreateButtonFull (305, 200, 0, "Sinker",
sinkerScreen, 0, '^S', false)
draw6 := GUI.CreateButtonFull (305, 225, 0, "Continue",
mainMenu, 0, '^S', false)
draw7 := GUI.CreateButtonFull (302, 100, 0, "Exit",
GUI.Quit, 0, '^E', false)
draw8 := GUI.CreateButtonFull (298, 125, 0, "Continue",
batter1, 0, '^C', false)
draw9 := GUI.CreateButtonFull (0, 150, 0, "Continue",
mainMenu, 0, '^C', false)



% loadingScreen
loop
exit when GUI.ProcessEvent
end loop


goodBye


][img][/img]
[/code]
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: