Class: Ending

Inherits:
Chingu::GameState
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/gui/gosu/chinguroids/ending.rb

Overview

ENDING GAMESTATE

the beginning of the end

Instance Method Summary collapse

Instance Method Details

#setupObject



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/ending.rb', line 114

def setup
  self.input = { :esc => :exit, [:enter, :return] => Ending2, :p => Pause, :r => lambda{current_game_state.setup} }

  @player = EndPlayer.create(:x => 400, :y => 640, :angle => 0, :velocity_x => 0, :velocity_y => 0, :zorder => Zorder::Main_Character)
  @earth = Earth1.create(:x => 400, :y => 200)
  # EndPlayer and Earth1 are defined in objects.rb
  @text = Chingu::Text.create("The Earth has been saved.", :y => 900, :font => "GeosansLight", :size => 46, :color => Colors::White, :zorder => 300)
  @text.x = 400 - @text.width/2 

  after(5000) { @player.accelerate }    # scripts affecting Earth, EndPlayer; push Ending2 gamestate
  after(10500) { @earth.motion }
  after(20000) { @earth.motion_easing }
  after(18500) { @player.shrink1}
  after(19500) { @player.shrink2; @player.adjust_particles }
  after(25700) { @player.decelerate }
  after(33000) { push_game_state(Chingu::GameStates::FadeTo.new(Ending2.new, :speed => 10)) }
end

#updateObject

update



133
134
135
136
137
138
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/ending.rb', line 133

def update
  super
  if @text.y >= 400            # text scrolls in at end of gamestate, tracking EndPlayer movement
    @text.y = @player.y + 330
  end
end