Castle Library
In the last section, you already saw an example of the Castle library: castle.closestActorWithTag("ground")
There are a few other useful functions in the Castle library. Here's an example of using castle.createActor
. Try tapping on the Wall to trigger onMessage
.
Note that this script uses math.random
, which is part of the Lua math library.
This deck contains the default "Wall" blueprint with a script added.
Another useful function in the Castle library is castle.actorsWithTag
. This example uses castle.actorsWithTag
to move all of the Balls into a row when you tap the Wall:
This deck contains the default "Wall" and "Ball" blueprints with a script added to "Wall".
You can find a list of all the Castle library functions here