
-----------------------------------
TokenHerbz
Fri Jul 29, 2005 6:43 pm

snake game help
-----------------------------------
Hi, i need help with my snake game...


%My snake game
View.Set("graphics:500;500,nocursor")

%%%INTRO%%%
var textc: int
var font1 := Font.New ("Impact:30")
var font2 := Font.New ("Comicsans:50")
var font3 := Font.New ("Roman:10")
var text1 := "Welcome    to"
var text2 := "S N A K E"
var text3 := "By: ***** ******"
var text4 := "G A M E"
var text5 := "O V E R"
var width1 := Font.Width (text1,font1)
var width2 := Font.Width (text2,font2)
var width3 := Font.Width (text3,font3)
var width4 := Font.Width (text4,font2)
var width5 := Font.Width (text5,font2)

loop
    randint (textc,1,100)
    Font.Draw (text1, round (maxx / 2 - width1 / 2), 350, font1, textc)
    Font.Draw (text2, round (maxx / 2 - width2 / 2), 200, font2, textc)
    Font.Draw (text3, round (maxx / 2 - width3 / 2), 20, font3, textc)
    delay(50)
    exit when hasch
end loop
cls

%%%GAME%%%
var x, y: int       %%Snake
var x1, y1: int     %%Food
var speed: int := 1
var c: int          %%Color
var snake: array char of boolean
var fs: int := 20   %%Food size

randint(x,20,480)       %%Spawn snake
randint(y,20,480)
randint(x1,20,480)      %%Spawn food
randint(y1,20,480)
randint(c,1,255)
drawfilloval(x,y,5,5,c)

loop
%Moving snake
    Input.KeyDown (snake)

    if snake (KEY_UP_ARROW) then
        y := y + speed
    end if
    if snake (KEY_DOWN_ARROW) then
        y := y - speed
    end if
    if snake (KEY_RIGHT_ARROW) then
        x := x + speed
    end if
    if snake (KEY_LEFT_ARROW) then
        x := x - speed
    end if
    %%Change color of snake
    if snake (' ') then
        randint (c,1,255)
    end if
    if x 