Function:
To get all actors in a group.
the snippet.
codes
actor group id found in preview code.
Built in Groups in Stencyl that cannot be removed
Group ID |
Group Name |
-2 |
Regions |
0 |
Players |
1 |
Tiles |
2 |
Doodads |
3 |
Actors |
User-created groups has other 4 or higher number. in this case its user-created so the number is 4.
this table can also be found in https://stencyl-nator.blogspot.com/p/actor-groups.html
preview code.
for(actorInGroup in cast(getActorGroup(4), Group).list)
{
if(actorInGroup != null && !actorInGroup.dead && !actorInGroup.recycled){
}
}
code mode without import com.stencyl.behavior.Script.*;
for(actorInGroup in cast(Script.getActorGroup(4), Group).list)
{
if(actorInGroup != null && !actorInGroup.dead && !actorInGroup.recycled){}
}
computational shortcut level1:
for(actorInGroup in cast(Engine.engine.getGroup(4), Group).list)
{
if(actorInGroup != null && !actorInGroup.dead && !actorInGroup.recycled){}
}
computational shortcut level2
for(actorInGroup in cast(Engine.engine.groups.get(4), Group).list)
{
if(actorInGroup != null && !actorInGroup.dead && !actorInGroup.recycled){}
}
No comments:
Post a Comment