Class: GamesAndRpgParadise::Bullet
- Inherits:
-
Chingu::GameObject
- Object
- Chingu::GameObject
- GamesAndRpgParadise::Bullet
- Defined in:
- lib/games_and_rpg_paradise/gui/gosu/chinguroids/objects.rb
Overview
BULLET
technically speaking, it's a laser, but it's still called "Bullet"
Instance Method Summary collapse
-
#initialize(options) ⇒ Bullet
constructor
A new instance of Bullet.
- #update ⇒ Object
Constructor Details
#initialize(options) ⇒ Bullet
Returns a new instance of Bullet.
177 178 179 180 181 182 183 |
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/objects.rb', line 177 def initialize() super(.merge(:image => Gosu::Image["assets/laser.png"])) @speed = 7 self.velocity_x = Gosu::offset_x(@angle, @speed) self.velocity_y = Gosu::offset_y(@angle, @speed) @max_x, @max_y, @scr_edge = $max_x, $max_y, $scr_edge end |
Instance Method Details
#update ⇒ Object
185 186 187 188 189 190 191 192 193 |
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/objects.rb', line 185 def update @y += self.velocity_y @x += self.velocity_x if @x < -@scr_edge; @x = @max_x; end # wrap beyond screen edge if @y < -@scr_edge; @y = @max_y; end if @x > @max_x; @x = -@scr_edge; end if @y > @max_y; @y = -@scr_edge; end after(550) {self.destroy} # goes through screen edges, but only to a certain distance end |