Class: GameScene

Inherits:
Metro::Scene show all
Defined in:
lib/templates/game/scenes/game_scene.rb

Direct Known Subclasses

BrandScene, BrandToTitleScene, FirstScene, TitleScene

Constant Summary

Constants included from Metro::Units

Metro::Units::Bounds

Instance Attribute Summary

Attributes inherited from Metro::Scene

#window

Instance Method Summary collapse

Methods inherited from Metro::Scene

#_prepare_transition, #actor, #add_actors_to_scene, after, #after, #after_initialize, after_intervals, #base_draw, #base_update, #draw, #drawers, #enqueue, hierarchy, inherited, #initialize, metro_name, #notification, #prepare_transition_from, #prepare_transition_to, #register_actor, #register_actors!, #register_after_intervals!, #register_animations!, #register_events!, #register_events_for_target, #scene_name, scene_name, scenes, #show, #state, #to_hash, #to_s, #transition_to, #update, #updaters

Methods included from Metro::SceneView

included, #save_view, #view, #view_content, #view_name

Methods included from Metro::HasAnimations

#animate, included

Methods included from Metro::HasEvents

included

Methods included from Metro::Draws

included

Constructor Details

This class inherits a constructor from Metro::Scene

Instance Method Details

#fade_in_and_out(name) ⇒ Object

This animation helper will fade in and fade out information.



33
34
35
36
37
38
39
40
41
# File 'lib/templates/game/scenes/game_scene.rb', line 33

def fade_in_and_out(name)
  animate name, to: { alpha: 255 }, interval: 2.seconds do
    after 1.second do
      animate name, to: { alpha: 0 }, interval: 1.second do
        yield if block_given?
      end
    end
  end
end