Class: Ending2

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

Overview

ENDING2 GAMESTATE

the middle of the end

Instance Method Summary collapse

Instance Method Details

#setupObject



148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/ending.rb', line 148

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

  @player = EndPlayerSide.create(:x => 880, :y => 150, :angle => -90, :velocity_x => -0.7, :velocity_y => 0, :zorder => Zorder::Main_Character)
  @earth = Earth2.create(:x => 150, :y => 300)
  # EndPlayerSide and Earth2 are defined in objects.rb
  @y_change = 0.3

  after(22000) { @earth.motion_easing }
  after(26000) { Sound['media/audio/huge_crowd2.ogg'].play(0.5)}
  after(29000) { push_game_state(Ending3) }#(Chingu::GameStates::FadeTo.new(Ending3.new, :speed => 10)) }
end

#updateObject



165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/ending.rb', line 165

def update
  super
  if @player.y <= 490         # trial and error adjustments to landing approach
    @player.y += @y_change
  end
  if @player.x <= 650
    @player.factor *= 0.998
    @player.adjust_particles
  end
  if @player.y >= 440
    y_damp
  end
  if @player.x <= 100
    @player.velocity_x *= 0.995
  end
end

#y_dampObject



161
162
163
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/ending.rb', line 161

def y_damp
  @y_change *= 0.997
end