Im trying to make a title menu for my "game" (is more like a template) and the menu have 3 options selectables with the keyboard arrows, the problem is that if I use button_down? to move the index, it move too fast and is imposible to choose the 2ยบ option, is like:
-New Game -Continue -Exit
the problem is that you cant select continue due at index speed (which is moved by button_down?), i tried using a variable @pause to detect the keys only certain time, but have bad responde.
Gosu dont have different type of buttons detection?
I worked with other library (RGSS) and it have 3: -trigger -repeat -press
Press is what button_down? make in gosu, trigger only return the first frame pressed and repeat alternates returning true and false. is hard to implement this to the library? thanks :3
It's all there, just overload the "button_down" method of Window (no question mark), just like in the tutorial game :)
button_down is the callback that you use for one-time events, button_down? is the check that you use in your logic for holding keys down. You can also combine both, i.e. shoot on the first button_down and then count the ticks from then on, repeating the fire after every 10, etc.
By ?
Date 2009-08-14 12:33
cool, my problem now is this(another one wee):
My "game" is divided in scenes (like the rest of RPGs), and the update is in the actual scene, the window update only have a $scene.update and the method button_down/button_up is from and only for the Window class, so i cant use it or overwrite it in the sub-updates. Im using a miserly method to try to remedy it (a case in window class, to know what scene is and lock button_down in that mode) but Im looking for a better solution ;o;
Cant add a module or something for input? leaving away the Window class :S
Game < Gosu::Window def button_up(id) $scene.button_up(id) end
def button_down(id) $scene.button_down(id) end end
Then you can use button_down/up the same way in a scene as in the main window.
What you want is probably a full game state system.
Actually over the summer I've worked on framework for ruby gosu (called Chingu) which includes stack-based (push/pop) game states among other things. You could check it out @ http://github.com/ippa/chingu/tree/master if you want, it's starting get in usable shape.
I'm working on something very similar (about routing the inputs and stuff to a "state" of sorts), and your app will help me to flesh out some stuff! :D