Class: Splash
- Inherits:
-
Chingu::GameState
- Object
- Chingu::GameState
- Splash
- Defined in:
- lib/prkwars/splash.rb
Overview
Class representing the game state right after turning the game on.
Instance Method Summary collapse
-
#play ⇒ Object
A method called when the player presses space in order to play the game.
-
#setup ⇒ Object
A setup method called by the chingu library when the
Splashclass gets pushed into the game state stack/gets switched to.
Instance Method Details
#play ⇒ Object
A method called when the player presses space in order to play the game. Uses the transitional_game_state method provided by the chingu library in order to make things prettier.
28 29 30 31 |
# File 'lib/prkwars/splash.rb', line 28 def play transitional_game_state(Chingu::GameStates::FadeTo, speed: 10) switch_game_state(Play.new) end |
#setup ⇒ Object
A setup method called by the chingu library when the Splash class gets pushed into the game state stack/gets switched to. Sets up input for exit/playing the game and sets up splash messages.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/prkwars/splash.rb', line 11 def setup self.input = { space: :play, esc: :exit } Chingu::Text.create('PRK WARS', x: 20, y: 20, size: 60, color: Gosu::Color::RED) Chingu::Text.create('A simple Grid Wars/Geometry Wars clone', x: 20, y: 90, size: 30) Chingu::Text.create('Press <space> to play the game, <esc> to exit.', x: 20, y: 130, size: 30) Chingu::Text.create('Controls: WASD: movement, arrow keys: shooting'\ ' direction.', x: 20, y: 170, size: 30) end |