set display mode 1024,768,32 bodylength=5 autocam off `set Frame Rate sync rate 20 `hide the mouse hide mouse `make ground (So I can see how fast I'm going) color backdrop 0 `make the head make object sphere 2,4,30,30 color object 2,rgb(0,255,50) position object 2,20,0,20 make object cube 100,5 scale object 100,4000,100,80 position object 100,100,0,0 make object cube 101,5 scale object 101,80,100,4000 position object 101,200,0,100 make object cube 102,5 scale object 102,80,100,4000 position object 102,0,0,100 make object cube 103,5 scale object 103,4000,100,80 position object 103,100,0,200 make object cube 104,5 scale object 104,4000,1,4000 position object 104,100,0,100 color object 104,rgb(0,255,0) for x=100 to 103 color object x,rgb(0,0,255) ghost object on x next x `Prepare to make body parts t=3 partcolor=1 `The body part making loop for t=3 to bodylength `Make a body part make object sphere t,3,30,30 ` color it if partcolor=1 partcolor=2 color object t,rgb(0,100,0) else partcolor=1 color object t,rgb(0,255,50) endif next t position camera object position x(2),object position y(2)+100,10 point camera object position x(2),object position y(2)+100,0 xrotate camera 90 ` game loop crntspd=10.0 do if crntpiece=0 make object sphere bodylength+1,4,30,30 color object bodylength+1,rgb(255,0,0) set object specular bodylength+1,rgb(255,0,0) position object bodylength+1,rnd(180)+5,0,rnd(180)+5 crntpiece=1 endif if object collision(2,bodylength+1) delete object bodylength+1 make object sphere bodylength+1,3,30,30 if partcolor=1 partcolor=2 color object bodylength+1,rgb(0,100,0) else partcolor=1 color object bodylength+1,rgb(0,255,50) endif bodylength=bodylength+1 crntpiece=0 crntspd=crntspd+1.0 endif `set camera to follow snake position camera object position x(2),object position y(2)+140,object position z(2) `Control the way the head faces by moving the mouse if leftkey()=1 then turn object left 2,12 if rightkey()=1 then turn object right 2,12 for a=100 to 103 if object collision(2,a) repeat ink rgb(255,255,255),0 set text size 48 center text screen width()/2,screen height()/2,"YOU LOSE" until entry$() end endif next a ` position the bits t=bodylength for a=4 to bodylength position object t,object position x(t-1),object position y(t-1),object position z(t-1) t=t-1 next a `this want's to be outside the loop because the last body part has to be attatched to the head. position object 3, object position x(2),object position y(2),object position z(2) `move the head in the direction it's facing move object 2,crntspd/10.0 `put the camera in the right place. loop