I'M getting the following error when I try to compile this code: "'Function' can only appear in main program."
[code];Draw a ship which can be moved and killed
Graphics 400, 300
Const STARTHITPOINTS = 3
Const SHIP$ = "<-*->"
Const ESCKEY = 1, SPACEBAR = 57, UPKEY = 200, LEFTKEY = 203, DOWNKEY = 208, RIGHTKEY = 205
Const STARTX = 200, STARTY = 150
Field x, y
Global cont = 1
Global player.ship = New ship
playerx = STARTX
playery = STARTY
playerhitpoints = STARTHITPOINTS
playershipstring = SHIP$
While cont = 1
Text playerx, playery, playershipstring$
;End of loop
;FUNCTION TextInput() - changes the direction or hit points of the player
;If player presses left, move him left.
playerx = playerx - 3
If playerx <= 0<br /> playerx = 10
;If player presses right, move him right.
playerx = playerx + 3
If playerx >= 385
playerx = 380
;If player presses up, move him up
playery = playery - 3
If playery <= 0<br /> playery = 10
;If player presses down, move him down.
playery = playery + 3
If playery >= 285
playery = 280
;If player presses spacebar, remove a hit point
playerhitpoints = playerhitpoints - 1
If playerhitpoints <= 0<br /> cont = 0
;If player presses Esc, set cont to 0, and exit the game
cont = 0
;Function DrawHUD() - draws the user's info in top Right of the screen
Text 260, 10, "X position: " + playerx
Text 260, 20, "Y positoin: " + playery
Text 260, 30, "Hitpoints: " + playerhitpoints