Class: Petli::Stages::Main

Inherits:
Base show all
Defined in:
lib/petli/stages/main.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
# File 'lib/petli/stages/main.rb', line 4

def actions
  return %w(light) if @pet.lights_out
  acts = %w(play feed light)
  acts << "clean" if @pet.poops.count > 0
  acts
end

#onkey(event) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/petli/stages/main.rb', line 11

def onkey(event)
  return @pet.light_switch if event.value == "l"
  return if @pet.lights_out
  return goto(Feed, pet: @pet) if event.value == "f"
  return @pet.clean if event.value == "c"
  return goto(Play, pet: @pet) if event.value == "p"
end