Hi, post to ask if there is a way to use the method button_down(id) out of a class that inherits from Window. Example: I can invoke the method button_down?(id) outside as follows: window.button_down?, returning true if I press a button, but as I do with the method button_down(id)??
I tried to do the following:
def window.button_down(id)
if id == KbUp then
puts 1
end
end
But got no results.
I hope their solutions, bye!
By lol_o2
Date 2012-05-10 08:05
Make a button_down(id)
method inside class you wan to use it and then call it from Window.button_down(id)
class GameWindow < Window
def button_down(id)
other_class.button_down(id)
end
end
This syntax seems to be for a singleton method defined on the window variable, which might not be what you intend to do. Still, I don't think that should cause any problems.
Can you clarify whether you are attempting to define #button_down() or #button_down?() ?
The former is what you want to be redefining in descendants of Gosu::Window. The latter is used to see if the given key is currently depressed or not.
Loading...