i just signed up to these forums and i was wondering if i could get some help with my turing project in classs... it shouldnt b very hard for all u pros but here is the code.
Turing: |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%opening Scene%
process musicopen
Music.PlayFile ("theme.WAV")
end musicopen
process background
var x1, y1, x2, y2, c : int
for x : 1 .. 700
randint (x1, 1, 640)
randint (x2, 1, 640)
randint (y1, 1, 400)
randint (y2, 1, 400)
randint (c, 1, 16)
drawline (x1, y1, x2, y2, c )
delay (25)
end for
end background
proc opening
setscreen ("graphics")
var font1 : int := Font.New ("Goudy Stout:55")
var c : int
fork musicopen
fork background
for x : 1 .. 44
randint (c, 1, 16)
Font.Draw ("S", 20, 250, font1, c )
Font.Draw ("S", 145, 175, font1, c )
delay (75)
Font.Draw ("P", 100, 250, font1, c )
Font.Draw ("A", 215, 175, font1, c )
delay (75)
Font.Draw ("E", 180, 250, font1, c )
Font.Draw ("Y", 295, 175, font1, c )
delay (75)
Font.Draw ("L", 260, 250, font1, c )
Font.Draw ("S", 375, 175, font1, c )
delay (75)
Font.Draw ("L", 340, 250, font1, c )
delay (75)
Font.Draw ("E", 420, 250, font1, c )
delay (75)
Font.Draw ("R", 500, 250, font1, c )
end for
end opening
%outline of shapes%
proc shapes
drawbox (200, 200, 150, 150, black)
drawoval (300, 175, 35, 35, black)
drawstar (215, 215, 125, 275, black)
Draw.MapleLeaf (245, 215, 365, 285, black)
end shapes
%colored shapes%
proc leaf
drawfillmapleleaf (245, 215, 365, 285, red)
end leaf
proc star
drawfillstar (215, 215, 125, 275, yellow)
end star
proc oval
drawfilloval (300, 175, 35, 35, blue)
end oval
proc box
drawfillbox (200, 200, 150, 150, green)
end box
%clear shapes%
proc leafclear
drawfillmapleleaf (245, 215, 365, 285, white)
Draw.MapleLeaf (245, 215, 365, 285, black)
end leafclear
proc starclear
drawfillstar (215, 215, 125, 275, white)
drawstar (215, 215, 125, 275, black)
end starclear
proc ovalclear
drawfilloval (300, 175, 35, 35, white)
drawoval (300, 175, 35, 35, black)
end ovalclear
proc boxclear
drawfillbox (200, 200, 150, 150, white)
drawbox (200, 200, 150, 150, black)
end boxclear
%Array%
var simonsays : array 1 .. 10 of int
proc fillsimon
var i : int
for x : 1 .. 10
randint (i, 1, 4)
simonsays (x ) := i
end for
end fillsimon
proc runsimon (level : int)
var d : int
if level = 1 then
d := 450
elsif level = 2 then
d := 425
elsif level = 3 then
d := 400
elsif level = 4 then
d := 375
elsif level = 5 then
d := 350
elsif level = 6 then
d := 325
elsif level = 7 then
d := 300
elsif level = 8 then
d := 275
elsif level = 9 then
d := 250
elsif level = 10 then
d := 100
end if
for x : 1 .. level
if simonsays (x ) = 1 then
delay (d )
Music.PlayFile ("firstbeep.MP3")
leaf
delay (d )
leafclear
elsif simonsays (x ) = 2 then
delay (d )
Music.PlayFile ("secondbeep.WAV")
star
delay (d )
starclear
elsif simonsays (x ) = 3 then
delay (d )
Music.PlayFile ("thirdbeep.WAV")
oval
delay (d )
ovalclear
elsif simonsays (x ) = 4 then
delay (d )
Music.PlayFile ("fourthbeep.WAV")
box
delay (d )
boxclear
end if
end for
end runsimon
%Human Interaction%
proc playgame
cls
put "Get Ready to Play!!!!"
delay (1000)
cls
var chars : array char of boolean
shapes
loop
Input.KeyDown (chars )
if chars (KEY_UP_ARROW) then
star
Music.PlayFile ("secondbeep.WAV")
delay (75)
starclear
end if
if chars (KEY_RIGHT_ARROW) then
leaf
Music.PlayFile ("firstbeep.MP3")
delay (75)
leafclear
end if
if chars (KEY_LEFT_ARROW) then
box
Music.PlayFile ("fourthbeep.WAV")
delay (75)
boxclear
end if
if chars (KEY_DOWN_ARROW) then
oval
Music.PlayFile ("thirdbeep.WAV")
delay (75)
ovalclear
end if
end loop
shapes
end playgame
%Closing Screen%
process musicclose
Music.PlayFile ("slacker.WAV")
end musicclose
process backgroundend
var x1, y1, x2, y2, c : int
for x : 1 .. 220
randint (x1, 1, 640)
randint (x2, 1, 640)
randint (y1, 1, 400)
randint (y2, 1, 400)
randint (c, 1, 16)
drawline (x1, y1, x2, y2, c )
delay (25)
end for
end backgroundend
proc gameover
setscreen ("graphics")
var font1 : int := Font.New ("Goudy Stout:55")
var c : int
fork musicclose
fork backgroundend
for x : 1 .. 25
randint (c, 1, 16)
Font.Draw ("G", 135, 250, font1, c )
Font.Draw ("O", 145, 175, font1, c )
delay (75)
Font.Draw ("A", 200, 250, font1, c )
Font.Draw ("V", 215, 175, font1, c )
delay (75)
Font.Draw ("M", 285, 250, font1, c )
Font.Draw ("E", 295, 175, font1, c )
delay (75)
Font.Draw ("E", 390, 250, font1, c )
Font.Draw ("R", 375, 175, font1, c )
end for
end gameover
%Sequence for gameplay%
opening
cls
shapes
fillsimon
runsimon (1)
playgame
runsimon (2)
playgame
runsimon (3)
playgame
runsimon (4)
playgame
runsimon (5)
playgame
runsimon (6)
playgame
runsimon (7)
playgame
runsimon (8)
playgame
runsimon (9)
playgame
runsimon (10)
playgame
gameover
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
anyways my only problem right now is that i need to get my playgame proc to remember what runsimon(1) through (10) did and also recognize what button was pressed and then to figure out if it was correct or not. any feed back would b awesome thanks |