Use the arrow keys to change direction of snake.
Silverlight plugin is required to play games within browser, Use Internet Explorer (NOT Chrome)
restart: GraphicsWindow.Title = "Snake V1.2" GraphicsWindow.PenWidth = 1 GraphicsWindow.BrushColor= "black" GraphicsWindow.DrawText(100,203,"Snake V1.2") GraphicsWindow.BrushColor ="red" bait = Shapes.AddRectangle(10,10) GraphicsWindow.BrushColor ="darkgreen" man = Shapes.AddRectangle(10,10) GraphicsWindow.BrushColor ="green" man2 = Shapes.AddRectangle(10,10) man3 = Shapes.AddRectangle(10,10) man4 = Shapes.AddRectangle(10,10) man5 = Shapes.AddRectangle(10,10) man6 = Shapes.AddRectangle(10,10) man7 = Shapes.AddRectangle(10,10) man8 = Shapes.AddRectangle(10,10) bx = Math.GetRandomNumber(19)*10 by = Math.GetRandomNumber(19)*10 width = 300 height = 300 sc = 0 'GraphicsWindow.DrawRectangle(0,0,width,height) GraphicsWindow.Show() GraphicsWindow.Width = 200 GraphicsWindow.Height = 220 x = 0 y = 0 x2 = 0 y2 = 0 x3 = 0 y3 = 0 x4 = 0 y4 = 0 x5 = 0 y5 = 0 x6 = 0 y6 = 0 x7 = 0 y7 = 0 x8 = 0 y8 = 0 start: Shapes.Move(bait,bx,by) Shapes.Move(man2,x2,y2) Shapes.Move(man3,x3,y3) Shapes.Move(man4,x4,y4) Shapes.Move(man5,x5,y5) Shapes.Move(man6,x6,y6) Shapes.Move(man7,x7,y7) Shapes.Move(man8,x8,y8) keyp = GraphicsWindow.LastKey If keyp = "Up" Then y = y-10 EndIf If keyp = "Down" Then y = y+10 EndIf If keyp = "Left" Then x = x-10 EndIf If keyp = "Right" Then x = x+10 EndIf ' TextWindow.WriteLine(keyp) Shapes.Move(man,x,y) Program.Delay(100-sc) x8 = x7 y8 = y7 x7 = x6 y7 = y6 x6 = x5 y6 = y5 x5 = x4 y5 = y4 x4 = x3 y4 = y3 x3 = x2 y3 = y2 x2 = x y2 = y If x = bx And y =by Then bx = Math.GetRandomNumber(19)*10 by = Math.GetRandomNumber(19)*10 sc = sc+1 GraphicsWindow.BrushColor= "white" GraphicsWindow.FillRectangle(10,201,80,20) GraphicsWindow.BrushColor= "black" GraphicsWindow.DrawText(11,203,"Score: "+sc) EndIf If x = -10 Or x = 200 Or y = -10 Or y = 200 Then GraphicsWindow.Clear() Goto restart EndIf Goto start |