Class: Logic::Scenario
- Inherits:
-
Object
- Object
- Logic::Scenario
- Extended by:
- Forwardable
- Defined in:
- lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/logic/scenario.rb
Instance Attribute Summary collapse
-
#ground_manager ⇒ Object
readonly
Returns the value of attribute ground_manager.
-
#pipe_manager ⇒ Object
readonly
Returns the value of attribute pipe_manager.
Instance Method Summary collapse
-
#initialize(window:, game:) ⇒ Scenario
constructor
A new instance of Scenario.
- #move! ⇒ Object
-
#objects ⇒ Object
objects.
-
#reset! ⇒ Object
reset!.
Constructor Details
#initialize(window:, game:) ⇒ Scenario
Returns a new instance of Scenario.
24 25 26 27 28 29 30 |
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/logic/scenario.rb', line 24 def initialize(window:, game:) @window = window @game = game @ground_manager = Logic::GroundManager.new @pipe_manager = Logic::PipeManager.new(window: window, game: game) @score ||= Square.new(size: 100, x: 94, y: 205, z: -9999, color: 'black') end |
Instance Attribute Details
#ground_manager ⇒ Object (readonly)
Returns the value of attribute ground_manager.
19 20 21 |
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/logic/scenario.rb', line 19 def ground_manager @ground_manager end |
#pipe_manager ⇒ Object (readonly)
Returns the value of attribute pipe_manager.
19 20 21 |
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/logic/scenario.rb', line 19 def pipe_manager @pipe_manager end |
Instance Method Details
#move! ⇒ Object
43 44 45 46 |
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/logic/scenario.rb', line 43 def move! ground_manager.move! pipe_manager.move! if @game.started? end |
#objects ⇒ Object
objects
39 40 41 |
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/logic/scenario.rb', line 39 def objects [*grounds, *pipes] end |
#reset! ⇒ Object
reset!
33 34 35 36 |
# File 'lib/games_and_rpg_paradise/games/flappy_bird/ruby2d/logic/scenario.rb', line 33 def reset! @score.z = -9999 [ground_manager, pipe_manager].map(&:reset!) end |