Program Snake Define Xpoint As Int Define Ypoint As Int Define IsDead As Bool Define Size As Decimal Method LoadMainSprite() LoadSprite("MainSprite", "spider.png") ShowSprite("MainSprite") ScaleSprite("MainSprite", 0.1) SetSpriteZIndex("MAinSprite",3) End Method Method DrawBackground() LoadSprite("background","green01.bmp") ScaleSprite("background" ,5) StampSprite("background") End Method Method LoadSpot() LoadSprite ("Spot","BlueBall.png") MoveSpriteToPoint("Spot" ,Random (1,1200),Random(1,900)) // Use Ycoordinate 1 to 675 if on laptop and 1 to 900 if at school ShowSprite("Spot") End Method Method CheckForArrowKey() If IsKeyDown("Up") Then Ypoint = Ypoint - 2 Delay (10) End If If IsKeyDown("Right") Then Xpoint = Xpoint + 2 Delay (10) End If If IsKeyDown("Down") Then Ypoint = Ypoint + 2 Delay (10) End If If IsKeyDown("Left") Then Xpoint = Xpoint - 2 Delay (10) End If If IsKeyDown("W") Then Ypoint = Ypoint - 10 Delay (10) End If If IsKeyDown("D") Then Xpoint = Xpoint + 10 Delay (10) End If If IsKeyDown("S") Then Ypoint = Ypoint + 10 Delay (10) End If If IsKeyDown("A") Then Xpoint = Xpoint - 10 Delay (10) End If MoveSpriteToPoint("MainSprite",Xpoint, Ypoint) End Method Method DetectWall() If (YPoint<0) Or (XPoint < 0) Or (XPOint > 1200) Or (YPoint > 900 ) Then // Use Ycoordinate 1 to 675 if on laptop and 1 to 900 if at school IsDead = True End If End Method Method DetectEat() Define Eat As String[] Eat = GetSpritesThatIntersectWith ("Spot") If ArrayLength(Eat) > 0 Then UnloadSprite("Spot") LoadSprite("Spot","BlueBall.png") MoveSpriteToPoint("Spot",Random (1,1200),Random(1,900)) // Use Ycoordinate 1 to 675 if on laptop and 1 to 900 if at school ShowSprite("Spot") Size = Size + 0.1 ScaleSprite("MainSprite",Size) End If End Method Method LoadDino() LoadSprite( "Item", "Dino.gif" ) MoveSpriteToPoint( "Item", Random( 50, ScreenWidth() - 50 ), Random( 50, ScreenHeight() - 50 ) ) ShowSprite( "Item" ) Var Timeline As Int[10] Timeline[1] = 100 Timeline[2] = 100 Timeline[3] = 100 Timeline[4] = 100 Timeline[5] = 100 Timeline[6] = 100 Timeline[7] = 100 Timeline[8] = 100 Timeline[9] = 100 Timeline[10] = 100 SetSpriteAnimationTimeline( "Item", True, Timeline ) SetSpriteCanCollide("Item", False) SetSpriteZIndex("Item",1) End Method Method Main() IsDead = False Status("Use the arrow keys to move or WASD for a speed boost!!") LoadMainSprite() DrawBackground() LoadDino() LoadSpot()) While IsDead = False CheckForArrowKey() DetectEat() DetectWall() End While Alert("You Lose"," Game Over") End Method End Program