class ScriptedFlxTransitionableState
package funkin.modding.base
extends FlxTransitionableState › FlxState › FlxTypedContainer › FlxTypedGroup › FlxBasic
implements HScriptedClass
Available on all platforms
A script that can be tied to an FlxTransitionableState. Create a scripted class that extends FlxTransitionableState to use this.
Static methods
staticinit(clsName:String, ?TransIn:TransitionData, ?TransOut:TransitionData):ScriptedFlxTransitionableState
Initializes a scripted class instance using the given scripted class name and constructor arguments.
staticlistScriptClasses():Array<String>
Returns a list of all the scripted classes which extend this class.
staticscriptStaticCall(clsName:String, funcName:String):Dynamic
Call a custom static function on a scripted class, by the given name, with the given arguments.
staticscriptStaticGet(clsName:String, fieldName:String):Dynamic
Retrieves a custom static variable on a scripted class, by the given name.
staticscriptStaticSet(clsName:String, fieldName:String, ?fieldValue:Dynamic):Dynamic
Sets the value of a custom static variable on a scripted class, by the given name.
Constructor
Methods
add(basic:FlxBasic):FlxBasic
Polymod HScriptedClass override of add.
Adds a new FlxBasic subclass (FlxBasic, FlxSprite, Enemy, etc) to the group.
FlxGroup will try to replace a null member of the array first.
Failing that, FlxGroup will add it to the end of the member array.
WARNING: If the group has a maxSize that has already been met,
the object will NOT be added to the group!
Parameters:
basic | The |
|---|
Returns:
The same FlxBasic object that was passed in.
any(func:FlxBasic ‑> Bool):Bool
Polymod HScriptedClass override of any.
Tests whether any member satisfies the function.
Parameters:
func | The function that tests the members |
|---|
5.4.0
.clear():Void
Polymod HScriptedClass override of clear.
Remove all instances of FlxBasic subclasses (FlxSprite, FlxTileblock, etc) from the list.
WARNING: does not destroy() or kill() any of these objects!
closeSubState():Void
Polymod HScriptedClass override of closeSubState.
Closes the substate of this state, if one exists.
countDead():Int
Polymod HScriptedClass override of countDead.
Call this function to find out how many members of the group are dead.
Returns:
The number of FlxBasics flagged as dead. Returns -1 if group is empty.
countLiving():Int
Polymod HScriptedClass override of countLiving.
Call this function to find out how many members of the group are not dead.
Returns:
The number of FlxBasics flagged as not dead. Returns -1 if group is empty.
every(func:FlxBasic ‑> Bool):Bool
Polymod HScriptedClass override of every.
Tests whether every member satisfies the function.
Parameters:
func | The function that tests the members |
|---|
5.4.0
.forEach(func:FlxBasic ‑> Void, recurse:Bool = false):Void
Polymod HScriptedClass override of forEach.
Applies a function to all members.
Parameters:
func | A function that modifies one element at a time. |
|---|---|
recurse | Whether or not to apply the function to members of subgroups as well. |
forEachAlive(func:FlxBasic ‑> Void, recurse:Bool = false):Void
Polymod HScriptedClass override of forEachAlive.
Applies a function to all alive members.
Parameters:
func | A function that modifies one element at a time. |
|---|---|
recurse | Whether or not to apply the function to members of subgroups as well. |
forEachDead(func:FlxBasic ‑> Void, recurse:Bool = false):Void
Polymod HScriptedClass override of forEachDead.
Applies a function to all dead members.
Parameters:
func | A function that modifies one element at a time. |
|---|---|
recurse | Whether or not to apply the function to members of subgroups as well. |
forEachExists(func:FlxBasic ‑> Void, recurse:Bool = false):Void
Polymod HScriptedClass override of forEachExists.
Applies a function to all existing members.
Parameters:
func | A function that modifies one element at a time. |
|---|---|
recurse | Whether or not to apply the function to members of subgroups as well. |
forEachOfType<K>(objectClass:Class<K>, func:K ‑> Void, recurse:Bool = false):Void
Polymod HScriptedClass override of forEachOfType.
Applies a function to all members of type Class<K>.
Parameters:
objectClass | A class that objects will be checked against before Function is applied, ex: |
|---|---|
func | A function that modifies one element at a time. |
recurse | Whether or not to apply the function to members of subgroups as well. |
getCameras():Array<FlxCamera>
Polymod HScriptedClass override of getCameras.
The cameras that will draw this. Use this.cameras to set specific cameras for this object,
otherwise the container's cameras are used, or the container's container and so on. If there
is no container, say, if this is inside FlxGroups rather than a FlxContainer then the
default draw cameras are returned.
5.7.0
.getDefaultCamera():FlxCamera
Polymod HScriptedClass override of getDefaultCamera.
The main camera that will draw this. Use this.cameras to set specific cameras for this
object, otherwise the container's camera is used, or the container's container and so on.
If there is no container, say, if this is inside FlxGroups rather than a FlxContainer
then FlxG.camera is returned.
5.7.0
.getFirst(func:FlxBasic ‑> Bool):Null<FlxBasic>
Polymod HScriptedClass override of getFirst.
Searches for, and returns the first member that satisfies the function.
Parameters:
func | The function that tests the members |
|---|
5.4.0
.getFirstAlive():Null<FlxBasic>
Polymod HScriptedClass override of getFirstAlive.
Call this function to retrieve the first object with dead == false in the group.
This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
Returns:
A FlxBasic currently flagged as not dead.
getFirstAvailable(?objectClass:Class<FlxBasic>, force:Bool = false):Null<FlxBasic>
Polymod HScriptedClass override of getFirstAvailable.
Call this function to retrieve the first object with exists == false in the group.
This is handy for recycling in general, e.g. respawning enemies.
Parameters:
objectClass | An optional parameter that lets you narrow the results to instances of this particular class. |
|---|---|
force | Force the object to be an |
Returns:
A FlxBasic currently flagged as not existing.
getFirstDead():Null<FlxBasic>
Polymod HScriptedClass override of getFirstDead.
Call this function to retrieve the first object with dead == true in the group.
This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
Returns:
A FlxBasic currently flagged as dead.
getFirstExisting():Null<FlxBasic>
Polymod HScriptedClass override of getFirstExisting.
Call this function to retrieve the first object with exists == true in the group.
This is handy for checking if everything's wiped out, or choosing a squad leader, etc.
Returns:
A FlxBasic currently flagged as existing.
getFirstIndex(func:FlxBasic ‑> Bool):Int
Polymod HScriptedClass override of getFirstIndex.
Searches for, and returns the index of the first member that satisfies the function.
Parameters:
func | The function that tests the members |
|---|
5.4.0
.getFirstNull():Int
Polymod HScriptedClass override of getFirstNull.
Call this function to retrieve the first index set to null.
Returns -1 if no index stores a null object.
Returns:
An Int indicating the first null slot in the group.
getLast(func:FlxBasic ‑> Bool):Null<FlxBasic>
Polymod HScriptedClass override of getLast.
Searches for, and returns the last member that satisfies the function.
Parameters:
func | The function that tests the members |
|---|
5.4.0
.getLastIndex(func:FlxBasic ‑> Bool):Int
Polymod HScriptedClass override of getLastIndex.
Searches for, and returns the index of the last member that satisfies the function.
Parameters:
func | The function that tests the members |
|---|
5.4.0
.getRandom(startIndex:Int = 0, length:Int = 0):FlxBasic
Polymod HScriptedClass override of getRandom.
Returns a member at random from the group.
Parameters:
startIndex | Optional offset off the front of the array.
Default value is |
|---|---|
length | Optional restriction on the number of values you want to randomly select from. |
Returns:
A FlxBasic from the members list.
insert(position:Int, object:FlxBasic):FlxBasic
Polymod HScriptedClass override of insert.
Inserts a new FlxBasic subclass (FlxBasic, FlxSprite, Enemy, etc)
into the group at the specified position.
FlxGroup will try to replace a null member at the specified position of the array first.
Failing that, FlxGroup will insert it at the position of the member array.
WARNING: If the group has a maxSize that has already been met,
the object will NOT be inserted to the group!
Parameters:
position | The position in the group where you want to insert the object. |
|---|---|
object | The object you want to insert into the group. |
Returns:
The same FlxBasic object that was passed in.
kill():Void
Polymod HScriptedClass override of kill.
Calls killMembers() and then kills the group itself.
Revive this group via revive().
killMembers():Void
Polymod HScriptedClass override of killMembers.
Calls kill() on the group's unkilled members. Revive them via reviveMembers().
5.4.0
.onFocus():Void
Polymod HScriptedClass override of onFocus.
This method is called after the game receives focus. Can be useful for third party libraries, such as tweening engines.
onFocusLost():Void
Polymod HScriptedClass override of onFocusLost.
This method is called after the game loses focus. Can be useful for third party libraries, such as tweening engines.
onResize(Width:Int, Height:Int):Void
Polymod HScriptedClass override of onResize.
This function is called whenever the window size has been changed.
Parameters:
Width | The new window width |
|---|---|
Height | The new window Height |
recycle(?objectClass:Class<FlxBasic>, ?objectFactory:() ‑> FlxBasic, force:Bool = false, revive:Bool = true):FlxBasic
Polymod HScriptedClass override of recycle.
Recycling is designed to help you reuse game objects without always re-allocating or "newing" them.
It behaves differently depending on whether maxSize equals 0 or is bigger than 0.
maxSize > 0 / "rotating-recycling" (used by FlxEmitter):
- at capacity: returns the next object in line, no matter its properties like alive, exists etc.
- otherwise: returns a new object.
maxSize == 0 / "grow-style-recycling"
- tries to find the first object with exists == false
- otherwise: adds a new object to the members array
WARNING: If this function needs to create a new object, and no object class was provided,
it will return null instead of a valid object!
Parameters:
objectClass | The class type you want to recycle (e.g. |
|---|---|
objectFactory | Optional factory function to create a new object
if there aren't any dead members to recycle.
If |
force | Force the object to be an |
revive | Whether recycled members should automatically be revived
(by calling |
Returns:
A reference to the object that was created.
remove(basic:FlxBasic, splice:Bool = false):FlxBasic
Polymod HScriptedClass override of remove.
Removes an object from the group.
Parameters:
basic | The |
|---|---|
splice | Whether the object should be cut from the array entirely or not. |
Returns:
The removed object.
replace(oldObject:FlxBasic, newObject:FlxBasic):FlxBasic
Polymod HScriptedClass override of replace.
Replaces an existing FlxBasic with a new one.
Does not do anything and returns null if the old object is not part of the group.
Parameters:
oldObject | The object you want to replace. |
|---|---|
newObject | The new object you want to use instead. |
Returns:
The new object.
revive():Void
Polymod HScriptedClass override of revive.
Calls reviveMembers() and then revives the group itself.
reviveMembers():Void
Polymod HScriptedClass override of reviveMembers.
Calls revive() on the group's killed members and then on the group itself.
5.4.0
.scriptCall(funcName:String, ?funcArgs:Array<Dynamic>):Dynamic
Calls a function of the scripted class with the given name and arguments.
scriptSet(varName:String, ?varValue:Dynamic):Dynamic
Directly modifies the value of a local variable of a scripted class.
transitionIn():Void
Polymod HScriptedClass override of transitionIn.
Starts the in-transition. Can be called manually at any time.
transitionOut(?OnExit:() ‑> Void):Void
Polymod HScriptedClass override of transitionOut.
Starts the out-transition. Can be called manually at any time.
update(elapsed:Float):Void
Polymod HScriptedClass override of update.
Automatically goes through and calls update on everything you added.