Class: Petli::Stages::Feed

Inherits:
Base show all
Defined in:
lib/petli/stages/feed.rb

Constant Summary

Constants inherited from Base

Base::GAME_HEIGHT, Base::GAME_WIDTH

Instance Attribute Summary

Attributes inherited from Tatty::Stage

#framerate

Instance Method Summary collapse

Methods inherited from Base

#action_bar, #action_pages, #draw, #initialize, #keypress, #left, #top

Methods inherited from Tatty::Stage

#draw, #goto, #initialize, #keypress, #leave, #move_to, #render, #render_at, #render_box, #screen_height, #screen_size, #screen_width, #step

Constructor Details

This class inherits a constructor from Petli::Stages::Base

Instance Method Details

#actionsObject



4
5
6
# File 'lib/petli/stages/feed.rb', line 4

def actions
  %w(bread snack med)
end

#onkey(event) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/petli/stages/feed.rb', line 8

def onkey(event)
  if event.value == "b"
    @pet.feed(food: :bread)
  elsif event.value == "s"
    @pet.feed(food: :candy)
  elsif event.value == "m"
    @pet.feed(food: :medicine)
  end
  goto(Main, pet: @pet)
end