How to reset an attribute
daniel.robert.campbell
Member Posts: 251
I'm making a peggle type variant. I'm having trouble getting an attribute to reset though. During the launching of the first ball, everything works fine. The ball hits a peg, the peg changes color, then the peg is destroyed when the ball hits the bottom of the scene.
I used an integer attribute with a default value of 1.
When a peg is hit, I change it to an actor that is set to destroy when that attribute has a value of 0.
The invisible actor I have at the bottom of the scene has a behavior to change that attribute to 0 when it comes into contact with the ball.
Basically I'm trying to find a quick way to reset that attribute to 1 so that everything will work correctly again.
I used an integer attribute with a default value of 1.
When a peg is hit, I change it to an actor that is set to destroy when that attribute has a value of 0.
The invisible actor I have at the bottom of the scene has a behavior to change that attribute to 0 when it comes into contact with the ball.
Basically I'm trying to find a quick way to reset that attribute to 1 so that everything will work correctly again.
Comments
I made a duplicate ball actor spawn at the top of the screen every subsequent time after the first ball. The only difference between this second ball actor and the first ball actor is that I added a rule to add +1 to the game attribute to reset it. WHEEEE!!! I'm learning!!!
PS: The reason I did not just add the rule to the first ball, is because it would add one to the attribute on it's first launch as well and then not work at all.