Addition Problem
I have an actor called Heart2, and an attribute called Health(index) default 500.
if attribute game.health=500 + touch is pressed
destroy actor
if attribute game.health=475 + touch is pressed
change att game.health to game.health+25 <----this works fine, and health goes to 500
destroy actor
if attribute game.health <=450 + touch is pressed
change att game.health to game.health+50 <---this works if it as 450, it will add up to 500
but, if it is at 425 or lower, it still adds it up to 500. Instead of 425 +50 =475.
I do have an actor Heart1 that does +25 hp and it works fine since the rule is very simple, meaning if it is 475 or below, add +25.
Am I missing something here?
if attribute game.health=500 + touch is pressed
destroy actor
if attribute game.health=475 + touch is pressed
change att game.health to game.health+25 <----this works fine, and health goes to 500
destroy actor
if attribute game.health <=450 + touch is pressed
change att game.health to game.health+50 <---this works if it as 450, it will add up to 500
but, if it is at 425 or lower, it still adds it up to 500. Instead of 425 +50 =475.
I do have an actor Heart1 that does +25 hp and it works fine since the rule is very simple, meaning if it is 475 or below, add +25.
Am I missing something here?
Best Answer
-
jckmcgraw Posts: 647
@Crestwood
I believe that you have some conflicting rules...
Rule: when game.health ≤ 425 + touch is pressed, change game.health to game.health + 50
Rule: when game.health = 475 + touch is pressed, change game.health to game.health + 25.
When the first rule triggers, it instantly changes game.health to 475. While touch is still pressed, (I think) that it is triggering the 2nd rule I mentioned. Therefor, when game.health ≤ 425 + touch is pressed, you may as well have it be when game.health ≤ 425 + touch is pressed, change attribute game.health to 500.
You will need to change something about those rules...
I hope this helps,
Jack McGraw
Answers
You are 100% correct. I added an attribute to fix this easily.
Thanks Jack!!
Glad I could help!