Module: StudioGame::Playable

Included in:
Player
Defined in:
lib/playable_module.rb

Overview

needs to write to health and read name

Instance Method Summary collapse

Instance Method Details

#blamObject



4
5
6
7
# File 'lib/playable_module.rb', line 4

def blam
   self.health -= 10           # the .self is REQUIRED on writable attributes (health)
   puts "#{name} got blammed!" # the .self is optional on readable attributes (name)
end

#strong?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/playable_module.rb', line 14

def strong?
   health > 100
end

#w00tObject



9
10
11
12
# File 'lib/playable_module.rb', line 9

def w00t
   self.health += 15
   puts "#{name} got w00ted!"
end