Hello, im creating a simple space invaders type game and I made it so that once a picture box (that being the bullet) has gone from the top of the screen, the bullet can be fired again using the space key, here is the code I currently have for the bullet.
pbBullet.Top = pbBullet.Top - 2 ' move toward 0 i.e. upwards
' when bullet goes off top of screen, set flag to false
If pbBullet.Top > 0 Then
bulletLive = True
Else
bulletLive = False
tmrBullet.Enabled = False ' prevent auto-firing
pbBullet.Hide()
Though I was curious to know what code I would use so that another bullet can be fired before the first one has left the screen and to only fire once the space bar has been pressed, keep in mind I have only been programming for a short while, so simple terminology would be greatly appreciated.
Thanks
pbBullet.Top = pbBullet.Top - 2 ' move toward 0 i.e. upwards
' when bullet goes off top of screen, set flag to false
If pbBullet.Top > 0 Then
bulletLive = True
Else
bulletLive = False
tmrBullet.Enabled = False ' prevent auto-firing
pbBullet.Hide()
Though I was curious to know what code I would use so that another bullet can be fired before the first one has left the screen and to only fire once the space bar has been pressed, keep in mind I have only been programming for a short while, so simple terminology would be greatly appreciated.
Thanks