diff --git a/prog2/rubyobjects/monster2.rb b/prog2/rubyobjects/monster2.rb new file mode 100644 index 0000000..972ac5e --- /dev/null +++ b/prog2/rubyobjects/monster2.rb @@ -0,0 +1,13 @@ +class Monster + attr_accessor :name, :current_hp, :max_hp + + def initialize(name, max_hp) + @name = name + @max_hp = max_hp + @current_hp = max_hp + end + + def alive? + @current_hp > 0 + end +end