Class: Star
- Inherits:
-
Chingu::GameObject
- Object
- Chingu::GameObject
- Star
- Defined in:
- lib/games_paradise/gui/gosu/chinguroids/objects.rb,
lib/games_paradise/gui/gosu/garden_hero/core/level/star.rb
Overview
#
Star - star class (collect by player)
#
Instance Attribute Summary collapse
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
-
#draw ⇒ Object
draw.
-
#initialize(window, x, y) ⇒ Star
constructor
initialize.
- #setup ⇒ Object
- #update ⇒ Object
Constructor Details
Instance Attribute Details
#x ⇒ Object (readonly)
Returns the value of attribute x.
15 16 17 |
# File 'lib/games_paradise/gui/gosu/garden_hero/core/level/star.rb', line 15 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
15 16 17 |
# File 'lib/games_paradise/gui/gosu/garden_hero/core/level/star.rb', line 15 def y @y end |
Instance Method Details
#draw ⇒ Object
draw
18 19 20 |
# File 'lib/games_paradise/gui/gosu/garden_hero/core/level/star.rb', line 18 def draw @img.draw(@x, @y, 1) end |
#setup ⇒ Object
200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/games_paradise/gui/gosu/chinguroids/objects.rb', line 200 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 |
#update ⇒ Object
213 214 215 216 217 |
# File 'lib/games_paradise/gui/gosu/chinguroids/objects.rb', line 213 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 |