Z
Zoe Phoenix
I'm playing around with making a small test game with what little Ruby
code I've learned so far and I feel like I'm doing good for only having
been learning the past couple of weeks or so. I've mostly been figuring
things out as I go, but I need a little help.
Say I wanted a character to be afflicted with a "poison" status that
removes 5% of their current HP. I know it should be a method that occurs
every few seconds (or just every turn) and that it should loop until
something is used to cure it or the battle ends, but I'm not sure how to
do this. I'd like to make it repeat every, say, 15 seconds or so, but I
guess it doesn't really matter how often, since this is just for
practice. The following code is incomplete (and possibly incorrect), but
please advise:
def poison
#loop begins.. help?
character.hp - (character.hp * 0.03)
puts 'Your HP dropped!' + Character[1].hp'/'+Character[1].maxhp
end #loop ends if battle ends or if antidote used
end
If anyone would like to school me on how I would apply an "antidote"
item to remove the effect, feel free to teach.
Before anybody says anything, I'm just doing this for practice... I have
no intention of trying to make a full game, lol. Just practicing with
bits and pieces of one.
code I've learned so far and I feel like I'm doing good for only having
been learning the past couple of weeks or so. I've mostly been figuring
things out as I go, but I need a little help.
Say I wanted a character to be afflicted with a "poison" status that
removes 5% of their current HP. I know it should be a method that occurs
every few seconds (or just every turn) and that it should loop until
something is used to cure it or the battle ends, but I'm not sure how to
do this. I'd like to make it repeat every, say, 15 seconds or so, but I
guess it doesn't really matter how often, since this is just for
practice. The following code is incomplete (and possibly incorrect), but
please advise:
def poison
#loop begins.. help?
character.hp - (character.hp * 0.03)
puts 'Your HP dropped!' + Character[1].hp'/'+Character[1].maxhp
end #loop ends if battle ends or if antidote used
end
If anyone would like to school me on how I would apply an "antidote"
item to remove the effect, feel free to teach.
Before anybody says anything, I'm just doing this for practice... I have
no intention of trying to make a full game, lol. Just practicing with
bits and pieces of one.