So basically, I'm a beginner trying to make a game on Small Basic. It's a space themed game, and there are going to be 2 spaceships, one red and one blue. So far, I'm coding the blue one and I want the controls to be like up arrow for blue to go forwards, down arrow to go back, left arrow to rotate left, and right arrow to rotate right. For this, I used the BluePlayer = Shapes.AddTriangle command, however, when I try to rotate or move the triangle, it disappears off screen. Please help. I will leave my code below for you to try to tinker around with it. Please comment if you come to any conclusion.
Code:
' Space Fighting Game"
' Setup
GraphicsWindow.BackgroundColor = "black"
GWW = 1025
GWH = 500
GraphicsWindow.Width = GWW
GraphicsWindow.Height = GWH
' Blue Player Setup
GraphicsWindow.BrushColor = "Aqua"
BlueX1 = GWW - 25
BlueY1 = GWH / 2 - 10
BlueX2 = BlueX1
BlueY2 = GWH / 2 + 10
BlueX3 = GWW - 50
BlueY3 = GWH / 2
PlayerBlue = Shapes.AddTriangle(BlueX1, BlueY1, BlueX2, BlueY2, BlueX3, BlueY3)
GraphicsWindow.KeyDown = WhenKeyPressed
Sub WhenKeyPressed
If GraphicsWindow.LastKey = "Up" Then
GraphicsWindow.Clear()
BlueX1 = BlueX1 - 10
BlueX2 = BlueX2 - 10
BlueX3 = BlueX3 - 10
PlayerBlue = Shapes.AddTriangle(BlueX1, BlueY1, BlueX2, BlueY2, BlueX3, BlueY3)
ElseIf GraphicsWindow.LastKey = "Down" Then
GraphicsWindow.Clear()
BlueX1 = BlueX1 + 10
BlueX2 = BlueX2 + 10
BlueX3 = BlueX3 + 10
PlayerBlue = Shapes.AddTriangle(BlueX1, BlueY1, BlueX2, BlueY2, BlueX3, BlueY3)
ElseIf GraphicsWindow.LastKey = "Left" Then
Shapes.Rotate(PlayerBlue, 100)
Shapes.Move
EndIf
EndSub