I'm making a scrolling shooter, and this annoying error message pops up when I try to run it, saying "variable must be a type." I dunno why it's doing this: I clearly set up the player type, and I believe I'm following all the proper syntax. Why, then, is this happening?
PS: Sorry, I don't know how to designate my typing as a code section, so the code starts here:
;/////// INIT ///////
;set up the graphics
Graphics 600,800
;enable double buffering
SetBuffer BackBuffer
;enable AutoMidHandle
AutoMidHandle True
;set key constants
Const KEY_ESC=1 ;escape
Const KEY_LEFT=203 ;left
Const KEY_RIGHT=205 ;right
Const KEY_UP=200 ;up
Const KEY_DOWN=208 ;down
;load the ship image
playerImage = LoadImage("ship_idle.bmp")
;player type
Type player
Field x,y
End Type
;create player
player1.player = New player
player\x = 400
player\y = 300
;/////// MAIN LOOP ///////
While Not KeyHit(KEY_ESC)
;clear screen
Cls
;move left
If KeyDown(KEY_LEFT)
player\x = player\x - 5
EndIf
;move right
If KeyDown(KEY_RIGHT)
player\x = player\x + 5
EndIf
;move up
If KeyDown(KEY_UP)
player\y = player\y - 5
EndIf
PS: Sorry, I don't know how to designate my typing as a code section, so the code starts here:
;/////// INIT ///////
;set up the graphics
Graphics 600,800
;enable double buffering
SetBuffer BackBuffer
;enable AutoMidHandle
AutoMidHandle True
;set key constants
Const KEY_ESC=1 ;escape
Const KEY_LEFT=203 ;left
Const KEY_RIGHT=205 ;right
Const KEY_UP=200 ;up
Const KEY_DOWN=208 ;down
;load the ship image
playerImage = LoadImage("ship_idle.bmp")
;player type
Type player
Field x,y
End Type
;create player
player1.player = New player
player\x = 400
player\y = 300
;/////// MAIN LOOP ///////
While Not KeyHit(KEY_ESC)
;clear screen
Cls
;move left
If KeyDown(KEY_LEFT)
player\x = player\x - 5
EndIf
;move right
If KeyDown(KEY_RIGHT)
player\x = player\x + 5
EndIf
;move up
If KeyDown(KEY_UP)
player\y = player\y - 5
EndIf