Class: Zif::Scene Abstract
Overview
Subclass and override at least #perform_tick.
A Scene is a full-screen view of your game. The concept is to show one scene at a time.
Each scene in your game should be a subclass of Scene which overrides at least #perform_tick.
Using the structure in Game, #perform_tick comes after input handling and before updating Actions::Actionables.
Your subclass should use #perform_tick to add/remove Clickables/Actions::Actionables, and respond to any detected input. #prepare_scene and #unload_scene will be called before and after scene transition.
Switching scenes is handled in Game, based on the return value of #perform_tick.
Direct Known Subclasses
Instance Method Summary collapse
-
#perform_tick ⇒ Symbol, ...
Your Scene subclass must override this method.
-
#prepare_scene ⇒ void
Optional - Your scene can use this for setup code before the scene is displayed.
-
#unload_scene ⇒ void
Optional - Your scene can use this for tear-down code when the scene is being transitioned away.
Methods included from Serializable
#exclude_from_serialize, #inspect, #serialize, #to_s
Instance Method Details
#perform_tick ⇒ Symbol, ...
Your Scene subclass must override this method.
74 75 76 |
# File 'lib/zif/scene.rb', line 74 def perform_tick raise "Zif::Scene#perform_tick: Please override #perform_tick for #{self.class}" end |
#prepare_scene ⇒ void
This method returns an undefined value.
Optional - Your scene can use this for setup code before the scene is displayed. You could register sprites with input service, etc.
81 |
# File 'lib/zif/scene.rb', line 81 def prepare_scene; end |
#unload_scene ⇒ void
This method returns an undefined value.
Optional - Your scene can use this for tear-down code when the scene is being transitioned away. You could reset input service clickables, etc
86 |
# File 'lib/zif/scene.rb', line 86 def unload_scene; end |