Results 1 to 17 of 17

Thread: Got idea.Don't know how...

  1. #1

    Thread Starter
    Addicted Member herpysz's Avatar
    Join Date
    Mar 2002
    Location
    Europe>Moldova>Kishinev
    Posts
    176

    Got idea.Don't know how...

    Hi!

    I'm a begginer in graphics and games developing...so I want to try to make a liitle game for practice.But I have a question:

    Tell me the best way to make some action when the player is pressing some key???

    Thanks!
    Next regards from Herpysz!

  2. #2
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Make a picture box and play with the left/top property of the picture box in the keydown event.....thats a good start....

  3. #3
    Fanatic Member Alien_poo's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    668
    or keypress...
    "A RESPECTED scientist has put forward the stunning - if unsavoury - possibility that humans are descended from sewage dumped overboard by aliens."
    "First we read that we are the creation of God, then scientists say we are descended from apes. Now they say we're some sort of alien poo. How much further can we sink?"
    - Robert Matthews, Science Correspondent

  4. #4
    Fanatic Member Alien_poo's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    668
    I think it was The Hobo who gave me this code a year ago.
    Attached Files Attached Files
    "A RESPECTED scientist has put forward the stunning - if unsavoury - possibility that humans are descended from sewage dumped overboard by aliens."
    "First we read that we are the creation of God, then scientists say we are descended from apes. Now they say we're some sort of alien poo. How much further can we sink?"
    - Robert Matthews, Science Correspondent

  5. #5

    Thread Starter
    Addicted Member herpysz's Avatar
    Join Date
    Mar 2002
    Location
    Europe>Moldova>Kishinev
    Posts
    176

    but...

    But if there are two players...than how i can get simultanious keypressing???
    Next regards from Herpysz!

  6. #6
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I hope The Hobo dsn't mind me ****ing up his code....

    I have made his example for 2players...
    Player 1 moves with the arrows....
    PLayer 2 moves with A, S, D, W...

    See if you can get it.....
    Attached Files Attached Files
    Last edited by NoteMe; Dec 10th, 2002 at 05:17 PM.

  7. #7
    Fanatic Member Alien_poo's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    668
    The Homo!?!
    "A RESPECTED scientist has put forward the stunning - if unsavoury - possibility that humans are descended from sewage dumped overboard by aliens."
    "First we read that we are the creation of God, then scientists say we are descended from apes. Now they say we're some sort of alien poo. How much further can we sink?"
    - Robert Matthews, Science Correspondent

  8. #8
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by Alien_poo
    The Homo!?!

    SORRY...I fixed that one up really fast...hehehehe

  9. #9
    Fanatic Member Alien_poo's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    668
    lol, but the hobo's code did have simultanious keypressing...
    that's why I asked for it, for my picture to go diagonaly...
    "A RESPECTED scientist has put forward the stunning - if unsavoury - possibility that humans are descended from sewage dumped overboard by aliens."
    "First we read that we are the creation of God, then scientists say we are descended from apes. Now they say we're some sort of alien poo. How much further can we sink?"
    - Robert Matthews, Science Correspondent

  10. #10
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by Alien_poo
    lol, but the hobo's code did have simultanious keypressing...
    that's why I asked for it, for my picture to go diagonaly...
    Yes it has...it was a nice demo for starting making games...and I fixed the code so there is two smiles taht can be moved my two diffrent persons...

  11. #11
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860

    here's the easiest way

    VB Code:
    1. Dim Keys(0 to 255) as boolean
    2. '----------------------
    3. Private Sub Form_Keydown(Keycode,Shift, etc)
    4. Keys(Keycode) = true
    5. End Sub
    6. '----------------------
    7. Private Sub Form_KeyUp(Keycode,Shift,etc)
    8. Keys(Keycode) = false
    9. End sub

    Just check if Keys(#) is true or false to know if a key is pressed, all you have to know is what code each key has.. yes print keycode in keydown to find that out really easily
    Don't pay attention to this signature, it's contradictory.

  12. #12
    Junior Member
    Join Date
    Dec 2002
    Posts
    17
    well.........how would you then make 2 characters move using Direct Draw, you can use the page flip method to make the charater look like he is walking, but how would you make that piece of animation move left and right across the screen. (in a 2d environment). (there are no picture boxes!!!!!!) ??????

  13. #13
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by raoul85
    well.........how would you then make 2 characters move using Direct Draw, you can use the page flip method to make the charater look like he is walking, but how would you make that piece of animation move left and right across the screen. (in a 2d environment). (there are no picture boxes!!!!!!) ??????
    No but you have left an top properties of the surfaces (rect)...so just blt your surface at the desired place on the monitor...

  14. #14
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190

    Re: here's the easiest way

    Originally posted by alkatran
    VB Code:
    1. Dim Keys(0 to 255) as boolean
    2. '----------------------
    3. Private Sub Form_Keydown(Keycode,Shift, etc)
    4. Keys(Keycode) = true
    5. End Sub
    6. '----------------------
    7. Private Sub Form_KeyUp(Keycode,Shift,etc)
    8. Keys(Keycode) = false
    9. End sub

    Just check if Keys(#) is true or false to know if a key is pressed, all you have to know is what code each key has.. yes print keycode in keydown to find that out really easily
    Yes, this is the esiest way, but you will get stuck up if the player (or both of them) are trying to press three or more keys at the same time..

  15. #15
    Addicted Member
    Join Date
    Aug 2002
    Location
    Baltimore, MD
    Posts
    230
    I would not recommend using the key events for any game. Poll the keyboard using the API or DirectInput. The VB events are too slow.

  16. #16
    Member
    Join Date
    Dec 2002
    Location
    Miami,FL
    Posts
    34
    The GetASyncKeyState API Works well
    Death is always smiling down on us, the only thing we can do is smile back

  17. #17
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Originally posted by RabidChimp
    The GetASyncKeyState API Works well
    Yes, it does...I have actually never used it before *embarrassed*, but I think that I will from now on...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width