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
7
8
9
10
11
12
# File 'lib/petli/stages/feed.rb', line 4

def actions
  acts = {
    bread: -> {feed(:bread)},
    snack: -> {feed(:candy)},
    else:  -> {goto(Main, pet: @pet)},
  }
  acts[:med] = -> {feed(:medicine)} if @pet.sick?
  acts
end

#feed(food) ⇒ Object



14
15
16
17
# File 'lib/petli/stages/feed.rb', line 14

def feed(food)
  @pet.feed(food: food)
  goto(Main, pet: @pet)
end