key press event

detecting simultaneous key presses

Page 1 of 1

2 Replies - 3949 Views - Last Post: 23 March 2010 - 02:52 PM Rate Topic: -----

#1 kstarian  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 13-July 09

key press event

Posted 23 March 2010 - 02:07 PM

ok so im making a mario side scroller ive figured out how to move and make him
jump now when i want to jump right the theory behind doing this would be if
right and space pressed then jump to the right, right? the only problem im
having now is vb.net either doesn't detect when one or more keys are pressed
or im doing it wrong, which i think and hope i am. so here we go anyway heres
a bit of me code for y'all to look at see if you can figure it out thanks
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown

        If e.KeyCode = Keys.Right And e.KeyCode = Keys.Space Then
            jump1.Enabled = True
        End If


        Me.Invalidate()
    End Sub



btw thats not all the code i commented out the walk right and left ect just to see if i could get this working

thanks

This post has been edited by kstarian: 23 March 2010 - 02:08 PM


Is This A Good Question/Topic? 0
  • +

Replies To: key press event

#2 kstarian  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 13-July 09

Re: key press event

Posted 23 March 2010 - 02:43 PM

guess what i also just solved this by setting up a magic number for key.right down so jump is now magic number + key.space up if you get that
thanks anyway
Was This Post Helpful? 0
  • +
  • -

#3 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: key press event

Posted 23 March 2010 - 02:52 PM

@kstarian You're going to need to remove your signature. It really breaks the hscroll of the site.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1