My scrolling shooter's going great, except for two problems. First off, I used this code to update the bullet position:
When I run it, it says "expecting 'Next'"
When I read the book "game programming for teens," and I saw and identical portion of code, there was no "Next" there, and they expect it to work. This is really annoying.
Second, whenever I place the key detection in a function, it goes wrong. First off, here's the key detection:
But if I put that in a function, like so:
then it gives me the message "variable must be a type." Why is this happening?
;/////// UPDATE BULLETS /////// For mainBullet.bullet = Each bullet mainBullet/y = mainBullet/y = 5
When I run it, it says "expecting 'Next'"
When I read the book "game programming for teens," and I saw and identical portion of code, there was no "Next" there, and they expect it to work. This is really annoying.
Second, whenever I place the key detection in a function, it goes wrong. First off, here's the key detection:
;move left If KeyDown(KEY_LEFT) player1\x = player1\x - moveSpeed EndIf ;move right If KeyDown(KEY_RIGHT) player1\x = player1\x + moveSpeed EndIf ;move up If KeyDown(KEY_UP) player1\y = player1\y - moveSpeed EndIf ;move down If KeyDown(KEY_DOWN) player1\y = player1\y + moveSpeed EndIf
But if I put that in a function, like so:
Function KeyControl() ;move left If KeyDown(KEY_LEFT) player1\x = player1\x - moveSpeed EndIf ;move right If KeyDown(KEY_RIGHT) player1\x = player1\x + moveSpeed EndIf ;move up If KeyDown(KEY_UP) player1\y = player1\y - moveSpeed EndIf ;move down If KeyDown(KEY_DOWN) player1\y = player1\y + moveSpeed EndIf End Function
then it gives me the message "variable must be a type." Why is this happening?