Class: Ending2

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

Overview

ENDING2 GAMESTATE

the middle of the end

Instance Method Summary collapse

Instance Method Details

#setupObject



137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/games_paradise/gui/gosu/chinguroids/ending.rb', line 137

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



154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/games_paradise/gui/gosu/chinguroids/ending.rb', line 154

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



150
151
152
# File 'lib/games_paradise/gui/gosu/chinguroids/ending.rb', line 150

def y_damp
  @y_change *= 0.997
end