Could you please answer a couple of (or four) questions for me, to
preserve my sanity?
1.
I have written a Space Invaders type game using the keyboard to move and
shoot. The problem is, when you hold down the key to keep moving the ship,
and then fire, the ship stops moving, and you have to repress the key to
start moving again. How can I rewrite this so that the ship keeps moving
when you fire?
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyEscape Then frmMenu.Show vbModal
If KeyAscii = 52 Then MoveShipLeft
If KeyAscii = 54 Then MoveShipRight
If KeyAscii = vbKeySpace And Shooting = False Then Shoot
End Sub
2.
Also, I wanted to use the arrow keys to move the ship, so I used vbKeyLeft
and vbKeyRight, but this didn't work. So I put the code
Debug.Print KeyAscii
in the above procedure to see what numbers I should use, but the arrow keys
didn't show a number when I pressed them.
The function keys didn't either.
Of the keys that did show an ascii code, most of them were different than
the ones in the Help.
Is there some property on the form I should change ? Or a keyboard setting
somewhere?
3.
At the start of the game, the high score table is loaded from a file into an
array.
If this file doesn't exist (eg. The first time the game is played) there's
an error.
How do I check if the file exists so I can skip the procedure if it doesn't?
I assume this uses the FileExists method, but can you please give me an
example ?
4.
If I load a picture into an image control at design time, and then make an
exe to send to someone, do I need to send them the picture as well, or is
that included in the executable ?
Please help, as I need to finish this game or I'll never get around to doing
the things I should be (assignments, eating, sleeping etc.)