Introduction
This one is the fisrt snippet to in Scenes Category it is just above the scene > actors > create actors on layer which is useful for game objects while create actors at FRONT is useful in buttons, HUDs and inventory.
Requirement for code mode
import com.stencyl.behavior.Script;
Snippet
Preview code - Note the actor type ID (in this case, 179) in Script.getActorType will be different from project to project. Use design mode > preview code to check the current actor typeID.
createRecycledActor(getActorType(179), 0, 0, Script.FRONT);
code mode without import com.stencyl.behavior.Script.*;
Script.createRecycledActor(getActorType(179), 0, 0, Script.FRONT);
computational shortcut level 1: - requires import com.stencyl.Engine;
Script.lastCreatedActor = Engine.engine.getRecycledActorOfType(Script.getActorType(179),0,0,Script.FRONT);
Futher shortcut leads to create actor on layer. The snippef below this snippet.
The file above can be found in Stencyl directory depends on where Stencyl is installed usually, Program Files > Stemcyl > plaf >haxe >lib > stencyl > 1,00 > com > stencyl :> Engine.hxcomputational shortcut level 2
Engine.engine.getRecycledActorOfTypeOnLayer(Script.getActorType(179),0,0,Engine.engine.getLayerByOrder(Script.FRONT).ID);
computational shortcut level 3
Engine.engine.getRecycledActorOfTypeOnLayer(Script.getActorType(179),0,0,Engine.engine.topLayer.ID);


No comments:
Post a Comment