Class: GamesAndRpgParadise::Meteor2
- Inherits:
-
Chingu::GameObject
- Object
- Chingu::GameObject
- GamesAndRpgParadise::Meteor2
- Defined in:
- lib/games_and_rpg_paradise/gui/gosu/chinguroids/objects.rb
Overview
METEOR 2 - MEDIUM
Meteor2 class is used in levels.rb
Instance Method Summary collapse
Instance Method Details
#setup ⇒ Object
283 284 285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/objects.rb', line 283 def setup @image = Image["media/assets/meteor.png"] self.zorder = 500 self.factor = 1.16 # meteor size self.velocity_x = (3 - rand * 6) * 2 # randomize location self.velocity_y = (3 - rand * 6) * 2 @angle = rand(360) # randomize rotation @rotate = 5 - rand(10) if @rotate == 0; @rotate = 6; end if rand(2) == 1; @rotate *= -1; end @max_x, @max_y, @scr_edge = $max_x, $max_y, $scr_edge cache_bounding_circle # cache meteor size for collision detection end |
#update ⇒ Object
297 298 299 300 301 302 303 |
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/objects.rb', line 297 def update @angle += @rotate if @x < -@scr_edge; @x = @max_x; end # wrap around screen beyond edges if @y < -@scr_edge; @y = @max_y; end if @x > @max_x; @x = -@scr_edge; end if @y > @max_y; @y = -@scr_edge; end end |