master
E. Almqvist 3 years ago
parent 6cb23fa9a3
commit 47ee07d1e0
  1. 13
      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
Loading…
Cancel
Save