How to subtract a value from integer?
Slayre77
Member, PRO Posts: 115
Silly question I know but then again Im not good at GS :P
Comments
Change Attribute self.HP to -1 will mean that when the actors collide your HP value will be changed to -1. (eg: Start out with a HP value of 7, then collide, HP is now -1 . . . or . . . start out with a HP value of 99, then collide, HP is now -1)
Change Attribute self.HP to self.HP-1 will mean that when the actors collide your HP value will go down by 1. (eg: Start out with a HP value of 7, then collide, HP is now 6 . . . or . . . start out with a HP value of 99, then collide, HP is now 98)
If your destroy condition is looking out for a value of 0 but only ever receives -1 it will never trigger.
Hi @Slayre77 by the sound of it you're best to have the HP attribute as a scene attribute. Suggestion: check if this attribute HP is integer as it should be....
Also remember to make the starting value of HP the max. number of points you start off with, otherwise you'll land up with minus numbers...
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
The red actor turns the attribute to true and . . .
The blue actor turns the attribute to false.
If this is how you have it set up then I suspect the blue change is cancelling out the red change.
Or if both are set to return true then your HP would be going down by 2 each time, but this is just guesswork as 'it doesn't work' could mean a million things, anything from the score goes up, to it goes down by the wrong amount, to it reaches 1 and stops (etc) ?