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

Username:   Password: 
 RegisterRegister   
 First Game I Ever Made
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
splik




PostPosted: Thu Mar 08, 2007 12:12 pm   Post subject: First Game I Ever Made

its an incredibly simple game where you have to use your mouse to catch the falling eyeballs in your cauldron.
highscores are erased when you leave the game, because i didnt know how to save information at the time.

ill just compy the code onto here because its short

i didnt comment it, but its easy to understand anyway

var x, y, btn, eyebally, vari, droppoint, ran, col, speed, pts, bestscore, lives : int
bestscore := 0
lives := 0
locate (9, 29)
put "Welcome to Eyeball Catcher!"
locate (11, 33)
put "By Tomas Zollinger"
locate (16, 33)
put "Click to continue!"
loop
mousewhere (x, y, btn)
if btn = 1 then
exit
else
end if
end loop
loop
eyebally := 385
vari := 1
speed := 4
pts := 0
cls
drawfillbox (1, 370, 640, 400, black)
loop
delay (speed)
mousewhere (x, y, btn)
drawfillbox (0, 0, 640, 369, white)
drawfilloval (x, 20, 30, 20, black)
drawfilloval (x, 28, 28, 15, black)
drawoval (x, 28, 28, 15, white)
drawfilloval (x, 25, 25, 10, green)
randomize
if vari = 1 then
randint (droppoint, 1, 625)
randint (ran, 1, 5)
if ran = 1 then
col := brown
elsif ran = 2 then
col := brightblue
elsif ran = 3 then
col := green
elsif ran = 4 then
col := darkgrey
else
col := blue
end if
else
end if
drawfilloval (droppoint + 15, eyebally, 18, 15, white)
drawoval (droppoint + 15, eyebally, 18, 15, black)
drawfilloval (droppoint + 15, eyebally, 9, 9, col)
drawfilloval (droppoint + 15, eyebally, 5, 5, black)
vari := 0
if eyebally < 30 then
if droppoint > (x - 28) and droppoint < (x - 6) then
pts := pts + 1
if pts = 5 then
speed := 3
elsif pts = 10 then
speed := 2
elsif pts = 20 then
speed := 1
elsif pts = 40 then
speed := 00005
else
end if
else
exit
end if
eyebally := 385
vari := 1
else
eyebally := eyebally - 1
end if
end loop
locate (9, 32)
put "You got ", pts, " points!"
if pts > bestscore then
locate (10, 29)
put "You got the best score!"
bestscore := pts
else
locate (10, 34)
put "Best Score: ", bestscore
end if
locate (16, 31)
put "Click to play again!"
loop
mousewhere (x, y, btn)
if btn = 1 then
exit
else
end if
end loop
end loop
Sponsor
Sponsor
Sponsor
sponsor
StealthArcher




PostPosted: Thu Mar 08, 2007 2:40 pm   Post subject: Re: First Game I Ever Made

code:
setscreen("offscreenonly")

var x, y, btn, eyebally, vari, droppoint, ran, col, speed, pts, bestscore, lives : int
bestscore := 0
lives := 0
locate (9, 29)
put "Welcome to Eyeball Catcher!"
locate (11, 33)
put "By Tomas Zollinger"
locate (16, 33)
put "Click to continue!"
View.Update
loop
mousewhere (x, y, btn)
if btn = 1 then
exit
else
end if
end loop
loop
eyebally := 385
vari := 1
speed := 4
pts := 0
cls
drawfillbox (1, 370, 640, 400, black)
loop
delay (speed)
mousewhere (x, y, btn)
drawfillbox (0, 0, 640, 369, white)
drawfilloval (x, 20, 30, 20, black)
drawfilloval (x, 28, 28, 15, black)
drawoval (x, 28, 28, 15, white)
drawfilloval (x, 25, 25, 10, green)
randomize
if vari = 1 then
randint (droppoint, 1, 625)
randint (ran, 1, 5)
if ran = 1 then
col := brown
elsif ran = 2 then
col := brightblue
elsif ran = 3 then
col := green
elsif ran = 4 then
col := darkgrey
else
col := blue
end if
else
end if
drawfilloval (droppoint + 15, eyebally, 18, 15, white)
drawoval (droppoint + 15, eyebally, 18, 15, black)
drawfilloval (droppoint + 15, eyebally, 9, 9, col)
drawfilloval (droppoint + 15, eyebally, 5, 5, black)
vari := 0
if eyebally < 30 then
if droppoint > (x - 28) and droppoint < (x - 6) then
pts := pts + 1
if pts = 5 then
speed := 3
elsif pts = 10 then
speed := 2
elsif pts = 20 then
speed := 1
elsif pts = 40 then
speed := 00005
else
end if
else
exit
end if
eyebally := 385
vari := 1
else
eyebally := eyebally - 1
end if
View.Update
end loop
locate (9, 32)
put "You got ", pts, " points!"
if pts > bestscore then
locate (10, 29)
put "You got the best score!"
bestscore := pts
else
locate (10, 34)
put "Best Score: ", bestscore
end if
locate (16, 31)
put "Click to play again!"
loop
mousewhere (x, y, btn)
if btn = 1 then
exit
else
end if
View.Update
end loop
end loop


Here is a fix. It flicker less.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: