Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / More than 1 key simultaneously down?
- - By roobert Date 2015-12-04 20:29
Hey guys, I'll have to make a ruby project soon for school and I want to make a game using gosu, I've already started, gone through a couple of tutorials, but I didn't come across a way to acknowledge that more than one button is being pressed, for example pressing W and D to move diagonally. Is there a way at all of do I have to rethink my whole game idea? Thanks in advance :)
Parent - By RunnerPack Date 2015-12-05 02:52
Testing to see if those keys are both down is as easy as:
@character.move_diagonally if button_down?(KbW) and button_down?(KbD) (and, no, that's not really how you'd do it in actual code, but that's the gist)
But your keyboard also has to support that on a hardware level. For more information, look up "NKRO" and how matrix keyboard decoding works.
Up Topic Gosu / Gosu Exchange / More than 1 key simultaneously down?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill