Class: Spacewar::Planet

Inherits:
Chingu::GameObject show all
Defined in:
lib/spacewar/spacewar.rb

Instance Method Summary collapse

Methods inherited from Chingu::GameObject

#adjust_gravity

Constructor Details

#initialize(options = {}) ⇒ Planet

Returns a new instance of Planet.



166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/spacewar/spacewar.rb', line 166

def initialize(options = {})
  super(:zorder => 1)
  @image = Image["planet.png"]
  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 = $window.width / 2
  self.y = $window.height / 2

  cache_bounding_circle
end