|
Hi people,
I am currently creating a Space Invaders game. Basically what i want to do is being able to move and shoot at the same time. Simple huh? The problem is that whenever one button is pressed to execute an action it cancels out any other button being pressed. I don't want that to happen. Currently i am just using Key down. Does anyone know how i can have multiple key presses at once?
Private Sub frmain_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Dim Loc As Point
Select Case e.KeyCode Case Keys.Left If Not pbplayer1.Location.X - 10 < 0 Then Loc = New Point(pbplayer1.Location.X - 10, pbplayer1.Location.Y) 'checks where player is on form and if they are inside the form move player pbplayer1.Location = Loc 'sets a new location of player End If
Case Keys.Right If Not pbplayer1.Location.X + 10 > Me.Width - pbplayer1.Width - 10 Then Loc = New Point(pbplayer1.Location.X + 10, pbplayer1.Location.Y) pbplayer1.Location = Loc End If
Case Keys.Space
Call missiletick()
Case Keys.P 'pause game If gametick.Enabled Then gametick.Stop() _ Else gametick.Start() If tmrmove.Enabled Then tmrmove.Stop() _ Else tmrmove.Start()
End Select End Sub
That's my code. This is basically the last thing i need done in my project so any help would be much appreciated.
ssenior
|