snake game
Author |
Message |
josh_65665
|
Posted: Sun Mar 09, 2008 3:45 pm Post subject: snake game |
|
|
View.Set ("graphics:800;600")
var KEY : string (1)
var XPOS, YPOS : int := 300
var XDIR, YDIR : int := 0
var LOSE : int := 0
var SCORE : int := 0
var ss : int := 0
var HARDNESS : int := 0
put "enter difficulty level 1 to 5 "
get HARDNESS
if HARDNESS > 5 then
HARDNESS := 5
elsif HARDNESS <= 0 then
HARDNESS := 1
end if
cls
locatexy (300, 300)
put "use w,a,s,d to move and dont touch blue"
Time.Delay (4000)
cls
Draw.Box (0, 0, maxx, maxy, blue)
Draw.Box (HARDNESS * 10, HARDNESS * 10, maxx - HARDNESS * 10, maxy - HARDNESS * 10, blue)
Draw.Fill (1, 1, blue, blue)
loop
if hasch then
getch (KEY)
if KEY = "w" then
YDIR := 1
XDIR := 0
ss := 5
elsif KEY = "a" then
YDIR := 0
XDIR := -1
ss := 5
elsif KEY = "s" then
YDIR := -1
XDIR := 0
ss := 5
elsif KEY = "d" then
YDIR := 0
XDIR := 1
ss := 5
end if
KEY := ""
end if
XPOS := XPOS + XDIR
YPOS := YPOS + YDIR
Draw.FillOval (XPOS, YPOS, 5, 5, red)
Time.Delay (8)
Draw.FillOval (XPOS, YPOS, 5, 5, blue)
if XDIR = 1 and whatdotcolor (XPOS + 6, YPOS) = blue then
LOSE := LOSE + 1
elsif XDIR = -1 and whatdotcolor (XPOS - 6, YPOS) = blue then
LOSE := LOSE + 1
elsif YDIR = 1 and whatdotcolor (XPOS, YPOS + 6) = blue then
LOSE := LOSE + 1
elsif YDIR = -1 and whatdotcolor (XPOS, YPOS - 6) = blue then
LOSE := LOSE + 1
end if
if ss = 5 then
SCORE := SCORE + 1
end if
exit when LOSE = 1
end loop
cls
put "game over"
put ""
put "your score was ", SCORE
put ""
if SCORE <= 500 then
put "you suck bit time"
elsif SCORE <= 1000 then
put "you can do better then that"
elsif SCORE > 1000 and SCORE <= 3000 then
put "not bad but try harder"
elsif SCORE > 3000 and SCORE <= 5000 then
put "i can see improvment"
elsif SCORE > 5000 and SCORE <= 8000 then
put "good"
elsif SCORE > 8000 and SCORE <= 11000 then
put "very very good"
elsif SCORE > 11000 then
put "you are almighty"
end if |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
syntax_error
![](http://compsci.ca/v3/uploads/user_avatars/196798963948cf16794b6e5.jpg)
|
Posted: Sun Mar 09, 2008 3:55 pm Post subject: RE:snake game |
|
|
try creating somethings for it to eat to get more points
EDIt: use CODE tags please. kthx. |
|
|
|
|
![](images/spacer.gif) |
Sean
![](http://compsci.ca/v3/uploads/user_avatars/47413941748406f441f83e.png)
|
Posted: Sun Mar 09, 2008 6:06 pm Post subject: Re: snake game |
|
|
Also, I believe you should fix up some stuff on the code, and try to improve it. For now, it's a good basic game.
Don't use code, use Syntax
[syntax="(Turing)"]
[/syntax]
Just don't use the brackets. |
|
|
|
|
![](images/spacer.gif) |
CodeMonkey2000
|
Posted: Sun Mar 09, 2008 6:16 pm Post subject: RE:snake game |
|
|
It really doesn't matter, as long as it's not regular test. |
|
|
|
|
![](images/spacer.gif) |
|
|