I'm doing a zelda style heart container thing to show hp. The only problem is how to add another heart to the present ones. If anyone knows how, i'd appreciate it.
Here's the set up. This is not my work and i take no credit for any of it.
Common Event:HEART
Event Start:PP(Paraelle Proccess)
Event Starts On:The very first event in the game
Fork Option:Varbl(0001:LinkHP)-3Above
Show Picture 1, heart1 (30,10)
Show Picture 2, heart2 (50,10)
Show Picture 3, heart3 (70,10)
Wait 2.0S
End Case
Fork Option:Varbl(0001:LinkHP)-3
Show Picture 1, heart1 (30,10)
Show Picture 2, heart2 (50,10)
Show Picture 3, heart3 (70,10)
Wait 1.0S
End Case
Fork Option:Varbl(0001:LinkHP)-2
Show Picture 1, heart1 (30,10)
Show Picture 2, heart2 (50,10)
Wait 2.0S
Earse Picture 3
End Case
Fork Option:Varbl(0001:LinkHP)-1
Show Picture 1, heart1 (30,10)
Wait 2.0S
Earse Picture 2
End Case
Fork Option:Varbl(0001:LinkHP)-2
Earse Picture 1
GameOver
Event 00001 off
End Case
If you don't know what I mean, it's like how in the zelda series when link(or whatever he's name)gets a heart from a boss and it's added to the others at the top of the screen.
First, you want to get rid of the very top Fork option (also, I believe the very bottom Fork option is supposed to check to see if your hit points equal 0, not 2). Then, in the HEART common event, for each possible number of hearts, you need a separate Fork option that checks to see if the variable LinkHP is equal to that value. For instance, if the maximum number of hearts that the player could ever obtain was 10, you would have to add a Fork option that checks to see if LinkHP equals 10 and then draws the appropriate number of hearts, a Fork option that checks to see if LinkHP equals 9 and then draws the appropriate number of hearts, and so on and so forth.
Okay I see what you're saying. I tried a set up very similar to this last night, and it slowed down my game badly. THis is it.
Fork Option:Varbl(0001:HP)-51Above
Show Picture 1, heart1 (30,10)
Show Picture 2, heart2 (50,10)
Show Picture 3, heart3 (70,10)
End Case
It's the same thing but, when all three pictures came up, the hero would skip through the walk animation.
Hmmm. The only thing I can think of that might reduce the lag is to change the event so that it's activated by a switch instead of running as a parallel process, turn the activating switch on whenever the player takes damage or receives healing, and then add a line to the bottom of the HEART event that turns the switch off. That way the event would only run once every time your health changed, instead of constantly running.
Thanks. I've gotten that bug fixed, now comes the part on how to add a fourth heart that will show an empty container when the correct damage is dealt. And with out being skipped for the third heart. This programing bit is a pain in the...well...you know.
Well, it's still more or less the same code, but now you have to stick it all inside another Fork that checks the player's maximum health and, if the current health is below the maximum health, draws the appropriate number of empty hearts before switching to filled hearts. Assuming the player starts with three hearts and can obtain a total possible of four hearts, the code would look like this:
Fork Option:Varbl(0001:MaxHP)-4
Fork Option:Varbl(0001:CurrentHP)-4
Show Picture 1, FilledHeart1 (30,10)
Show Picture 2, FilledHeart2 (50,10)
Show Picture 3, FilledHeart3 (70,10)
Show Picture 4, FilledHeart4 (90, 10)
End Case
Fork Option:Varbl(0001:CurrentHP)-3
Show Picture 1, FilledHeart1 (30,10)
Show Picture 2, FilledHeart2 (50,10)
Show Picture 3, FilledHeart3 (70,10)
Show Picture 4, EmptyHeart4 (90, 10)
End Case
Fork Option:Varbl(0001:CurrentHP)-2
Show Picture 1, FilledHeart1 (30,10)
Show Picture 2, FilledHeart2 (50,10)
Show Picture 3, EmptyHeart3 (70,10)
Show Picture 4, EmptyHeart4 (90, 10)
End Case
Fork Option:Varbl(0001:CurrentHP)-1
Show Picture 1, FilledHeart1 (30,10)
Show Picture 2, EmptyHeart2 (50,10)
Show Picture 3, EmptyHeart3 (70,10)
Show Picture 4, EmptyHeart4 (90, 10)
End Case
Fork Option:Varbl(0001:CurrentHP)-0
Erase Picture 1
Erase Picture 2
Erase Picture 3
Erase Picture 4
Game Over
End Case
End Case
Fork Option:Varbl(0001:MaxHP)-3
Fork Option:Varbl(0001:CurrentHP)-3
Show Picture 1, FilledHeart1 (30,10)
Show Picture 2, FilledHeart2 (50,10)
Show Picture 3, FilledHeart3 (70,10)
End Case
Fork Option:Varbl(0001:CurrentHP)-2
Show Picture 1, FilledHeart1 (30,10)
Show Picture 2, FilledHeart2 (50,10)
Show Picture 3, EmptyHeart3 (70,10)
End Case
Fork Option:Varbl(0001:CurrentHP)-1
Show Picture 1, FilledHeart1 (30,10)
Show Picture 2, EmptyHeart2 (50,10)
Show Picture 3, EmptyHeart3 (70,10)
End Case
Fork Option:Varbl(0001:CurrentHP)-0
Erase Picture 1
Erase Picture 2
Erase Picture 3
Game Over
End Case
End Case
It's a lot of code, but the good news is that once you set up the Fork for the maximum possible hearts, you can really just copy/paste it for all the others and change what value of MaxHP it's checking for.
Your a genius Draco. I was trying to do the fourth heart fork option, with out adding the others to it. Pure genius. 8)
Glad I could help. Good luck with your game :)