Class: Apple

Inherits:
Object
  • Object
show all
Defined in:
lib/games_paradise/gui/gosu/garden_hero/core/level/apple.rb

Overview

#

Apple - apple class (collect by player)

#

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(window, x, y) ⇒ Apple

initialize



10
11
12
13
# File 'lib/games_paradise/gui/gosu/garden_hero/core/level/apple.rb', line 10

def initialize(window, x, y)
  @window, @x, @y = window, x, y
  @img = Gosu::Image.new window, "images/player/apple.png", true
end

Instance Attribute Details

#xObject (readonly)

Returns the value of attribute x.



15
16
17
# File 'lib/games_paradise/gui/gosu/garden_hero/core/level/apple.rb', line 15

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



15
16
17
# File 'lib/games_paradise/gui/gosu/garden_hero/core/level/apple.rb', line 15

def y
  @y
end

Instance Method Details

#drawObject

draw



17
18
19
# File 'lib/games_paradise/gui/gosu/garden_hero/core/level/apple.rb', line 17

def draw
  @img.draw(@x, @y, 1)
end