Class: EndPlayer
- Inherits:
-
Chingu::GameObject
- Object
- Chingu::GameObject
- EndPlayer
- Defined in:
- lib/games_paradise/gui/gosu/chinguroids/objects.rb
Overview
END PLAYER
Player clone with no blinking, used in Introduction and Ending gamestates
Adds in some methods to adjust the spaceship size and movement as it descends to Earth
Instance Method Summary collapse
- #accelerate ⇒ Object
- #adjust_particles ⇒ Object
- #decelerate ⇒ Object
- #setup ⇒ Object
-
#shrink1 ⇒ Object
method called in Ending gamestate.
-
#shrink2 ⇒ Object
method called in Ending gamestate.
- #update ⇒ Object
Instance Method Details
#accelerate ⇒ Object
467 468 469 470 471 472 |
# File 'lib/games_paradise/gui/gosu/chinguroids/objects.rb', line 467 def accelerate if self.velocity_x <= @max_speed && self.velocity_y <= @max_speed self.velocity_x += Gosu::offset_x(self.angle, @speed) self.velocity_y += Gosu::offset_y(self.angle, @speed) end end |
#adjust_particles ⇒ Object
478 479 480 |
# File 'lib/games_paradise/gui/gosu/chinguroids/objects.rb', line 478 def adjust_particles @particles_slow = 0.997 end |
#decelerate ⇒ Object
474 475 476 |
# File 'lib/games_paradise/gui/gosu/chinguroids/objects.rb', line 474 def decelerate @easing = 0.99 end |
#setup ⇒ Object
447 448 449 450 451 452 453 454 455 456 457 |
# File 'lib/games_paradise/gui/gosu/chinguroids/objects.rb', line 447 def setup @image = Gosu::Image["assets/player.png"] @width, @height = 32, 32 @speed = 0.34 @max_speed, @part_speed, @rotate_speed = 10, 8, 5 @shoot = Sound["media/audio/laser.OGG"] @easing = 1.0 # amount to slow down EndPlayer each tick @shrinkage = 1.0 # amount to scale image each tick @particles_slow = 1.0 # amount to adjust particle particle speed self.factor = 1.0 end |
#shrink1 ⇒ Object
method called in Ending gamestate
459 460 461 |
# File 'lib/games_paradise/gui/gosu/chinguroids/objects.rb', line 459 def shrink1 # method called in Ending gamestate @shrinkage = 0.998 end |
#shrink2 ⇒ Object
method called in Ending gamestate
463 464 465 |
# File 'lib/games_paradise/gui/gosu/chinguroids/objects.rb', line 463 def shrink2 # method called in Ending gamestate @shrinkage = 0.996 end |
#update ⇒ Object
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 |
# File 'lib/games_paradise/gui/gosu/chinguroids/objects.rb', line 482 def update self.factor *= @shrinkage @part_speed *= @particles_slow self.velocity_x *= @easing self.velocity_y *= @easing Chingu::Particle.create(:x => @x, :y => @y, :image => "assets/particle_1.png", :color => 0xFF86EFFF, :mode => :default, :fade_rate => -45, :angle => @angle, :factor => @factor, :zorder => Zorder::Main_Character_Particles) Chingu::Particle.each { |particle| particle.y -= Gosu::offset_y(@angle, @part_speed); particle.x -= Gosu::offset_x(@angle, @part_speed)} Chingu::Particle.destroy_if { |object| object.outside_window? || object.color.alpha == 0 } end |