Class: PirateGame::Image
- Inherits:
-
WavingItem
- Object
- WavingItem
- PirateGame::Image
- Defined in:
- lib/pirate_game/image.rb
Instance Attribute Summary
Attributes inherited from WavingItem
Instance Method Summary collapse
- #animate(frame) ⇒ Object
- #draw ⇒ Object
-
#initialize(shoes, image, top, left) ⇒ Image
constructor
A new instance of Image.
Methods inherited from WavingItem
Constructor Details
#initialize(shoes, image, top, left) ⇒ Image
Returns a new instance of Image.
3 4 5 6 7 8 9 10 |
# File 'lib/pirate_game/image.rb', line 3 def initialize shoes, image, top, left super 0, 10, 4 @shoes = shoes @image = image @top = top @left = left end |
Instance Method Details
#animate(frame) ⇒ Object
12 13 14 15 16 |
# File 'lib/pirate_game/image.rb', line 12 def animate frame top_offset, left_offset = waving_offset frame @ship.move @top + top_offset, @left + left_offset end |
#draw ⇒ Object
18 19 20 |
# File 'lib/pirate_game/image.rb', line 18 def draw @ship = @shoes.image @image, top: @top, left: @left end |