The Armor Games website will be down for maintenance on Monday 10/7/2024
starting at 10:00 AM Pacific time. We apologize for the inconvenience.
The Armor Games website will be down for maintenance on Monday 10/7/2024
starting at 10:00 AM Pacific time. We apologize for the inconvenience.
1 | 4738 |
(Sorry about bad English)
for(<name of variable that instance name saves in it> in <target(?)>{}
Every Movieclip has thair Instance name even if you don`t set it. but you can`t know what is it. by using this, you don`t need to give Instance names to all of the movieclips in a stage.
ex) for(items in _root){trace(items);}
it will trace Instance names of all objects(Movieclips, variables,buttons(I`m not sure about buttons))in main timeline(_root).
if you want to make an RPG, and you need to make Monster`s AI(I think that you don`t want to see the Monsters pass through the wll), then put this script in wall:
onClipEvent(load){this.isWall=true;}
put this in the monsters:
onClipEvent(enterframe){
for(items in _root){if(_root[items].isWall==false){
continue;
//reduces lag a little
}else{
if(_root[items].hitTest(this)&&_root[items].isWall==true)
/*<target>[variables]. means object that in the target and its name is same as value of the variables*/
{<do what if you hit the wall>}}}}
Warning:don`t put too much movieclips. it will be laggy because for(~in~) is loop script.