Jump to content

Snake: Difference between revisions

Line 1,685:
dim sy[maxsize]
 
define fn (bounds) as sx[0] <= 0-10 or sx[0] >= gfxx or sy[0] <= 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
define fn (eatself) as sx[0] = sx[i] and sy[0] = sy[i]
Line 1,694:
title "Snake!"
 
resize 0, 0, gfxx + 1210, gfxy + 5056
center
 
fill on
bgcolor 0128, 8064, 0
cls
 
Line 1,706:
 
input "Enter game speed between 0 to 100+", speed
 
fgcolor 0, 80, 0
rect 0, 0, gfxx, gfxy
 
do
Line 1,801 ⟶ 1,804:
if (collision) = 1 then
 
fgcolor 0, 80, 0
cls
rect 0, 0, gfxx, gfxy
 
let rx = ( int: (rnd) * ( gfxx - 24 ) ) + 12
Line 1,814 ⟶ 1,818:
oval rx, ry, 15, 15
 
fgcolor 0255, 0, 2550
lineoval gfxxrx + 5, 0ry + 5, gfxx3, gfxy3
lineoval 0rx + 9, gfxyry + 5, gfxx3, gfxy3
 
fgcolor 255,255,0
305

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.