Snake: Difference between revisions
→{{header|Craft Basic}}
Basicgames (talk | contribs) |
Basicgames (talk | contribs) |
||
Line 1,672:
=={{header|Craft Basic}}==
<syntaxhighlight lang="basic">
rem www.lucidapogee.com
define gfxx = 330, gfxy = 296
define upkey = 0, rightkey = 0, downkey = 0, leftkey = 0, esckey = 0
define speed = 0, delay = 0, score = 0, game = 1
define maxsize = 1000, size = 9, direction = int
define rx =
define ry =
dim sx[maxsize]
dim sy[maxsize]
define fn (bounds) as sx[0] <= -10 or sx[0] >= gfxx or sy[0] <= -10 or sy[0] >= gfxy▼
define fn (collision) as sx[0] + 15 >= rx and sx[0] <= rx + 15 and sy[0] + 15 >= ry and sy[0] <= ry + 15▼
let sx[0] = gfxx / 2
Line 1,743 ⟶ 1,740:
fgcolor 0, 80, 0
oval sx[size], sy[size], 15, 15
let i = size + 1
Line 1,752 ⟶ 1,749:
let c = i - 1
if
let game = 0
Line 1,794 ⟶ 1,791:
endif
let game = 0
Line 1,800 ⟶ 1,797:
endif
▲
playwave "examples\tada.wav"
fgcolor 0, 80, 0
rect 0, 0, gfxx, gfxy
let rx =
let ry =
let size = size + 3
Line 1,820 ⟶ 1,819:
oval rx + 9, ry + 5, 3, 3
fgcolor 255, 255, 0
cursor 1, 1
print "Score: ", score
let delay =
do
Line 1,830 ⟶ 1,829:
wait
loop
loop esckey <> 1 and game = 1
playwave "examples\boom.wav"
alert "Game over! Score: ", score
|