Friday, February 13, 2009

Variables - part 2

Hi !

i had a lot of trouble with boolean variables, so i will teach you what i know so you don't get the problems i had.

Well let's start.
When stting a boolean variable, the classic way is:

var __________:Boolean = true;

or

var __________:Boolean = false;

and the easier way is:

_______ = true;

or

_______ = false

if you wanna change it, use this:

if (__________________) {
_______ = true;
}

or

if (__________________) {
_______ = false;
}

all this should not be a problem. The problem is, when the boolean is the condition.
Then, you have to use 2 equal signs. Like this example:

if (dead == true) {
_root.gotoAndStop ("dead");
}

get it ? - keep in mind that this also work for numbers, strings, and all kinds of variable. Also, when using numbers, you can type > and < signs:

if (life >=100) {
life = 100;
}

hope it helps you

0 comments:

Post a Comment