I've a SpriteKit action file with some actions inside.
To use one action, I use:
let action = SKAction(named: "Shake")
Instead is possible to use directly the name inside MyActions.sks file? Something like:
let actions = SKScene(fileNamed: "MyActions.sks")`
let shakeAction = actions.listOfAction.Shake //this is my guess
If I print the scene file:
let actions = SKScene(fileNamed: "MyActions.sks")
print(actions)
the output is:
Optional({
"_info" = {
"_previewScenePath" = "PippiPompiere/GameScene.sks";
};
actions = {
PlayerIdle1 = "<SKGroup: 0x79e60ec0>";
PlayerMoveToHouse0 = "<SKGroup: 0x7b1ea010>";
PlayerMoveToHouse1 = "<SKGroup: 0x7b052cd0>";
PlayerMoveToHouse2 = "<SKGroup: 0x7b1ebbd0>";
Rotate360 = "<SKGroup: 0x79e61710>";
Shake = "<SKGroup: 0x79e60a10>";
SunShake = "<SKGroup: 0x7b1e8620>";
WaterJet = "<SKGroup: 0x7b1e8ce0>";
};
})
(lldb)
is possible to have actions like an array?
thanks
AFAIK, you can get the actions dictionary from the
.sks
file. Here, I have aMyCustomActions.sks
file with an action Pulse.From here, you can implement your own
struct
from theactions
dictionary.To get all the name of actions,