Z
Zoe Phoenix
Okay, I took someone's advice in an earlier post I made on how to poison
a character in a test game I wanted to make by making a thread. I'm not
sure if this is correct or not, but this is what I have:
def poison
poisoned = thread.new
poisoned do
Character.hp - (rand(Character.hp * (10 - 5 + 1)/100) +
Character.hp*5/100)
puts 'Your HP dropped!' + Character.hp + '/' + Character.maxhp
sleep 20 #thread sleeps for 20 seconds
end
end
Can I do it this way, so "Character.poison" would start the thread? If
this would work, how would I use an "antidote" item to stop the thread?
a character in a test game I wanted to make by making a thread. I'm not
sure if this is correct or not, but this is what I have:
def poison
poisoned = thread.new
poisoned do
Character.hp - (rand(Character.hp * (10 - 5 + 1)/100) +
Character.hp*5/100)
puts 'Your HP dropped!' + Character.hp + '/' + Character.maxhp
sleep 20 #thread sleeps for 20 seconds
end
end
Can I do it this way, so "Character.poison" would start the thread? If
this would work, how would I use an "antidote" item to stop the thread?