Actor set frame using union type
@@ -11,17 +11,29 @@ const fields = [
{
key: "frame",
label: l10n("FIELD_ANIMATION_FRAME"),
- type: "number",
+ type: "union",
+ types: ["number", "variable", "property"],
+ defaultType: "number",
min: 0,
max: 25,
- defaultValue: 0
- }
+ defaultValue: {
+ number: 0,
+ variable: "LAST_VARIABLE",
+ property: "$self$:frame"
+ },
+ },
+
];
const compile = (input, helpers) => {
- const { actorSetActive, actorSetFrame } = helpers;
+ const { actorSetActive, actorSetFrame, actorSetFrameToVariable, variableFromUnion } = helpers;
actorSetActive(input.actorId);
- actorSetFrame(input.frame);
+ if(input.frame.type === "number") {
+ actorSetFrame(input.frame.value);
+ } else {
+ const frameVar = variableFromUnion(input.frame, "tmp1");
+ actorSetFrameToVariable(frameVar);
+ }
};
module.exports = {
