Class: GamesAndRpgParadise::Star

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

Overview

STAR CLASS

stars can be picked up by player; called in levels.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/objects.rb', line 203

def setup
  @animation = Chingu::Animation.new(:file => "../media/assets/living.png", :size => 64)
  @image = @animation.next
  self.zorder = 200
  self.color = Gosu::Color.new(0xff000000)
  self.color.red = rand(255 - 40) + 40
  self.color.green = rand(255 - 40) + 40
  self.color.blue = rand(255 - 40) + 40
  self.x = rand * 800
  self.y = rand * 600
  cache_bounding_circle     # A cached bounding circle will not adapt to changes in size, but it will follow objects X / Y
end

#updateObject



216
217
218
219
220
# File 'lib/games_and_rpg_paradise/gui/gosu/chinguroids/objects.rb', line 216

def update
  # Move the animation forward by fetching the next frame and putting it into @image
  # @image is drawn by default by GameObject#draw
  @image = @animation.next
end