Method: Actor#on_floor

Defined in:
lib/fantasy/actor.rb

#on_floor(&block) ⇒ Object

The block to be executed when the Actor touches floor

Examples:

Change image when jumping

actor = Actor.new("walk")
actor.on_floor do
  actor.image_name = "land"
  Clock.new { actor.image_name = "walk" }.run_on(seconds: 0.8)
end


471
472
473
# File 'lib/fantasy/actor.rb', line 471

def on_floor(&block)
  @on_floor_callback = block
end