Many of you are using the 'regular' way to create conditions and actions:
In this little tutorial, I'll tell you about something new, which will help you to increase your programming skill.
If you carefully read the manual, you may have noticed the following:
Looks interesting, so how do we use it?
Here is how I changed actions in the first screenshot:
An explanation:
If you click on Sprite, it fill add some number to Sprite.AnimationFrame. But what number it will be? Here works our logical expression:
sprite.Increase = 1? 1 : 0
That means: if variable Increase = 1 then it will add 1, in any other way, it will add 0;
You can make any logical expression you want, using this logical operators:
= - EQUALS
<> - NOT EQUALS
& - logical AND
| - logical OR
Here is some examples:
First
(self.var1 = 0) | (self.var2 = 0) ? 0 : 100
This one just check if var1 or var2 are greater than 0.
Second
((self.var1 > 0) & (self.var2 > 0)) & (self.var2 <> 100) ? 0 : 100
It check if var1 and var2 are greater then 0 and if var2 is not equal 100.
It might be usefull to make an exception in some cases.
Third
You can also put logical expression into results of logical expression =D
self.Var1 > 0 ? (self.Var2 = 0 ? 1 : 0) : (self.Var3 = 0 ? -1 : 0)
As you can see, it checkes:
If var1 is greater than 0, if so, if var2 is equals 0 we will get 1, else 0.
If var1 is not greater than 0, then it will check if var3 is equals 0 and will get us -1, or 0 in any other case.