GameMaker How To Check If Two Keys Are Pressed At Same Time

Поділитися
Вставка
  • Опубліковано 21 жов 2024
  • GameMaker tutorial / lesson with completed project files at gameprogrammingcourse.com in the RESOURCES section.
    Sometimes you need to know if the player is pressing down two or more keys at once. A good example is for diagonal movement, or for special player abilities. This video shows you a simple way to code this.
    Check out hundreds of other GameMaker tutorials and lessons at GameProgrammingCourse.com
    All these gamemaker tutorials will work with Gamemaker Studio GMS or Gamemaker Studio 2 GMS.
    Go to the Resource Page of www.gameprogram... to download the Project Files for these tutorials!

КОМЕНТАРІ • 11

  • @ArtsieFrog
    @ArtsieFrog 3 роки тому +1

    Thank you,
    I used this code after editing it a bit, to make it so my ship shoots both engines at once when both arrows are pressed.

  • @ShahAlam-ms9df
    @ShahAlam-ms9df 7 років тому

    Thanks. And nice voice btw :)

  • @JomyJonathan
    @JomyJonathan 9 років тому

    what code do you do to make it so an object moves diagonally

    • @gamemakergameprogrammingco4786
      @gamemakergameprogrammingco4786  9 років тому

      +Jomy Jonathan For diagonal up and right just check if the UP and RIGHT arrow keys are pressed (or whichever keys you are using). If they are then set the direction of the object with direction=45. You'll have to go through all 8 direction key combo's. Watch out for the order of your IF/ELSE IF's to make sure that you don't check for RIGHT ONLY first and get the player moving rightward thereby missing the UP AND RIGHT key combo - easy beginner error to make.

    • @JomyJonathan
      @JomyJonathan 9 років тому

      thanks!

    • @JomyJonathan
      @JomyJonathan 9 років тому

      btw it worked when I tried it so... DOUBLE THANKS!!!

    • @Dirkzy
      @Dirkzy 8 років тому +1

      Good to know that info about the sequencing. It helped me out.

  • @taintedkittystone
    @taintedkittystone 8 років тому

    So in my game I need to check if the player presses enter when solving a math problem, and I have to check to see if the player pressed enter when entering an answer or not entering anything. Help? This is what I have so far: if 'text' == " " && keyboard_key = vk_enter

    • @gamemakergameprogrammingco4786
      @gamemakergameprogrammingco4786  8 років тому

      for Windows programs there is a game maker method that will allow the user to enter some text. You can look this up in the help file. If you want the user to enter text on any other platform, you will actually have to construct some type of keyboard input for the player. This is not a quick task. I suggest you lookup tutorials on creating keyboard input. but like I said, if it's just for the windows platform, use the built-in method in gamemaker to get text input from the user.

    • @taintedkittystone
      @taintedkittystone 8 років тому

      Thank you :)

  • @EvyDevy
    @EvyDevy 8 років тому

    Cool, thanks.