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:
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:
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?
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.
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
If I understand your last problem correctly...
Game < Gosu::Window
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.
Here's an example of how Chingu adds easy handling of game states and inputs:http://github.com/ippa/chingu/blob/d2cb90d1efee6a7637a7a0a8a784f399a93d2a8b/examples/example4.rb
i love you :3
the game states are not a problem, im already using a sub-loops systems and works fine, only needs fades between scenes, but that can wait.
One of these days ill post the project, maybe someone want a RPG template "easy" to use ^^
Ahh! nice code there!
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
Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill