this is not a new AS: variable that I want to replace the "old" one.. but if you want to know more, this is the place..
you should read this first..
AS: Variables by Rantzien
ok, in the other AS: Variable you lurned how to declare variables.. but not how to read them..
there is diferent ways..
if:
lets say you want somthing to hapend if "number" =5..
then you have to use this code
if (number == 5){
//code here
}
one of the most comon errors I see here is people only have one "="
(number=5)
if you only have one "=" you sett the variable to 5
you need two "==" to check it..
you can also check if the information in the variable is corect..
if (name == "phyconinja"){
//code here
}
remember to have the " " there.. else it wont read it as information and try to use it as another variable..
you can also use < or >..
if (number>5){
//code here
}
checks if numer is bigger then 5
textbox
if you want the people who plays the game to see what the variable is, lets say its the health of the player.. you create a Dynamic textbox, and click on it.. you will see in the properties panel that ther is a part that says "var" that is the variable that the box will read.. make shure it is a time line variable
_root.health
Changing variables
another thing that didnt show in the last one was chaging the variable..
lets say you have a variable called "health" and you want it to go down by 10 points if "enemy" hits you..
read: AS Collision by Glaiel_Gamer
(hitTest)
if (this.hitTest(_root.enemy)){
health-=10;
}
health-=10; is the same as health = health -10;
you can have :
-= (number=number-"somthing")
+= (number=number+"somthing")
++ (number=number+1)
-- (number=number-1)
other useful tuts:
AS: Random by -Reedo11-
AS: Math by T-H AS: Arrays by Denvish
AS: Arrays by Creeepy
PS. I'm Norwegian, so my use of English may be bad...
lol
XD