If your clueless on what he just said than do this:
(For the sake of this mini-tutorial, lets pretend we're creating an enemy death method, and making it so that the method can only be called once)
First create a new variable by visiting the world properties tab and clicking 'Create new Variable'.
Set it's type to boolean (True/False) and it's name to EnemyAlive, make it's value set to 'True'.
Now in the methods tab create a new method and name it 'EnemyDeath' now your code for the method should be set to the following.
(sorry if this looks more like Java than alice, that's because I'm using pure text)
Code:
If EnemyAlive == true {
This will test if the boolean variable we created is equal to true.
Code:
//EnemyDeathCodeGoesHere
Set EnemyAlive == False
What we're doing here is initiating the enemy death code, disabiling his AI, and making him perform a death animation. Next we set the value of EnemyAlive to false, so that this method cannot be repeated more than once.
Now we finish things off by closing the If and opening the 'Else', as you can see, there is no code in the Else, so we simply close the else.
That's all of the method! What this does in a quick runthrough is simply. We have a variable that states our enemy is alive. Once he is shot we call on a method that makes him die. Inside this method we test a condition: if the EnemyAlive variable is true, than kill the enemy and set this variable to false, and then end the method. When we shoot the enemy again, it does the same method again but this time, since we set 'EnemyAlive' to false it skips the 'If' part (therefore not repeating the death animation) and begin the 'Else' part, which does nothing and than simply ends the method.
This is our methods code all in one:
Code:
If EnemyAlive == True{
//Enemy Die and Disable AI
Set EnemyAlive = False
}Else{
}
That's the complicated version of simple! Hope you enjoyed!