Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Using keyboard input other than arrow keys / escape
- - By Haz Date 2015-01-24 21:48
I'm trying to use WASD as movement keys instead of the arrow keys. My code is below. Arrow keys are working perfectly but i"m not getting any response from WASD. Any suggestions?

def update
    if button_down? Gosu::KbLeft or button_down? Gosu::KbA then
      @player.turn_left
    end
    if button_down? Gosu::KbRight or button_down? Gosu::KbD then
      @player.turn_right
    end
    if button_down? Gosu::KbUp or button_down? Gosu::KbW then
      @player.accelerate
    end
    @player.move
  end
Parent - - By lol_o2 Date 2015-01-24 22:21
Probably keyboard or system fault. Have you tried only WASD in the code? (it won't change anything, but check just in case)
Parent - - By Haz Date 2015-01-24 22:39
It never fails, right? As soon as I make an account and try to post for help, I realize the human error. I was editing a copy of the file and not the one I was running through the console.

I appreciate the response none the less.
Parent - By lol_o2 Date 2015-01-25 10:39
Well, this happens.
I remember my programming classes:
-Why this won't work?!
-You have to save first, you know...
-<facepalm>
Up Topic Gosu / Gosu Exchange / Using keyboard input other than arrow keys / escape

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill