| Class | Rubygame::EventActions::MethodAction |
| In: |
lib/rubygame/event_actions.rb
|
| Parent: | Object |
MethodAction is an event action used with EventHook. MethodAction takes a symbol giving the name of a method. When it is performed, it calls that method on the owner, passing it the event that triggered the hook.
Example:
class Player
def aim_at( event )
self.crosshair_pos = event.pos
end
end
player1 = Player.new
EventHook.new( :owner => player1,
:trigger => MouseMoveTrigger.new(),
:action => MethodAction.new( :aim_at ) )
Create a new MethodAction using the given method name.
| method_name: | the method to call when performing. (Symbol, required) |