From 3b2042560267a9444296c77570c4666b5d47f2e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Davy=20H=C3=A9lard?= Date: Thu, 23 May 2024 15:32:56 +0200 Subject: [PATCH] [Reviewed] [Camera shake] Use extension variables --- extensions/reviewed/CameraShake.json | 1684 +++++++++++++++----------- 1 file changed, 956 insertions(+), 728 deletions(-) diff --git a/extensions/reviewed/CameraShake.json b/extensions/reviewed/CameraShake.json index 99bc0567e..97e992335 100644 --- a/extensions/reviewed/CameraShake.json +++ b/extensions/reviewed/CameraShake.json @@ -8,7 +8,7 @@ "name": "CameraShake", "previewIconUrl": "https://resources.gdevelop-app.com/assets/Icons/vector-difference-ab.svg", "shortDescription": "Shake layer cameras.", - "version": "3.0.3", + "version": "3.1.0", "description": [ "Shake layer cameras with translation, rotation and zoom.", "", @@ -40,6 +40,129 @@ "m4hBMBTUilft4s1V4FQQPakVDGx1" ], "dependencies": [], + "globalVariables": [], + "sceneVariables": [ + { + "folded": true, + "name": "DefaultFrequency", + "type": "number", + "value": 12 + }, + { + "folded": true, + "name": "DefaultAmplitudeX", + "type": "number", + "value": 4 + }, + { + "folded": true, + "name": "DefaultAmplitudeY", + "type": "number", + "value": 4 + }, + { + "folded": true, + "name": "DefaultAmplitudeAngle", + "type": "number", + "value": 0 + }, + { + "folded": true, + "name": "DefaultAmplitudeZoom", + "type": "number", + "value": 1 + }, + { + "folded": true, + "name": "Duration", + "type": "number", + "value": 0 + }, + { + "name": "Layers", + "type": "structure", + "children": [] + }, + { + "name": "Layer", + "type": "structure", + "children": [ + { + "name": "AmplitudeAngle", + "type": "number", + "value": 0 + }, + { + "name": "AmplitudeX", + "type": "number", + "value": 0 + }, + { + "name": "AmplitudeY", + "type": "number", + "value": 0 + }, + { + "folded": true, + "name": "AmplitudeZoom", + "type": "number", + "value": 0 + }, + { + "folded": true, + "name": "CameraDeltaAngle", + "type": "number", + "value": 0 + }, + { + "name": "CameraDeltaX", + "type": "number", + "value": 0 + }, + { + "name": "CameraDeltaY", + "type": "number", + "value": 0 + }, + { + "folded": true, + "name": "CameraDeltaZoom", + "type": "number", + "value": 0 + }, + { + "folded": true, + "name": "Frequency", + "type": "number", + "value": 0 + } + ] + }, + { + "folded": true, + "name": "LayerName", + "type": "string", + "value": "" + }, + { + "folded": true, + "name": "Time", + "type": "number", + "value": 0 + }, + { + "folded": true, + "name": "StartEaseDuration", + "type": "number", + "value": 0 + }, + { + "folded": true, + "name": "StopEaseDuration", + "type": "number", + "value": 0 + } + ], "eventsFunctions": [ { "fullName": "", @@ -61,47 +184,6 @@ "\"\"", "" ] - }, - { - "type": { - "value": "CameraShake::SetDefaultShakingFrequency" - }, - "parameters": [ - "", - "12", - "" - ] - }, - { - "type": { - "value": "CameraShake::SetDefaultTranslationAmplitude" - }, - "parameters": [ - "", - "4", - "4", - "" - ] - }, - { - "type": { - "value": "CameraShake::SetDefaultRotationAmplitude" - }, - "parameters": [ - "", - "0", - "" - ] - }, - { - "type": { - "value": "CameraShake::SetDefaultZoomAmplitude" - }, - "parameters": [ - "", - "1", - "" - ] } ] } @@ -133,10 +215,10 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Time", + "Time", "+", "TimeDelta()" ] @@ -156,263 +238,47 @@ ] } ], - "actions": [ - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "__CameraShake.EaseFactor", - "=", - "1" - ] - } - ], + "actions": [], "events": [ { "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "VarScene" - }, - "parameters": [ - "__CameraShake.Time", - "<", - "Variable(__CameraShake.StartEaseDuration)" - ] - }, - { - "type": { - "inverted": true, - "value": "VarScene" - }, - "parameters": [ - "__CameraShake.Time", - ">", - "Variable(__CameraShake.Duration) - Variable(__CameraShake.StopEaseDuration)" - ] - } - ], - "actions": [ - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "__CameraShake.EaseFactor", - "=", - "clamp(0, 1, Variable(__CameraShake.Time) / Variable(__CameraShake.StartEaseDuration))" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "VarScene" - }, - "parameters": [ - "__CameraShake.Time", - ">", - "Variable(__CameraShake.Duration) - Variable(__CameraShake.StopEaseDuration)" - ] - } - ], - "actions": [ - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "__CameraShake.EaseFactor", - "=", - "clamp(0, 1, (Variable(__CameraShake.Duration) - Variable(__CameraShake.Time)) / Variable(__CameraShake.StopEaseDuration))" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::ForEachChildVariable", - "iterableVariableName": "__CameraShake.Layers", - "valueIteratorVariableName": "__CameraShake.Layer", - "keyIteratorVariableName": "__CameraShake.LayerName", - "conditions": [ - { - "type": { - "value": "SceneVariableAsBoolean" - }, - "parameters": [ - "__CameraShake.Layers[VariableString(__CameraShake.LayerName)].Shakable", - "True" - ] - } - ], + "conditions": [], "actions": [], "events": [ - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "ModVarSceneTxt" - }, - "parameters": [ - "__CameraShake.ActualLayerName", - "=", - "VariableString(__CameraShake.LayerName)" - ] - } - ] - }, { "type": "BuiltinCommonInstructions::Standard", "conditions": [ { "type": { - "value": "VarSceneTxt" - }, - "parameters": [ - "__CameraShake.LayerName", - "=", - "\"__BaseLayer\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ModVarSceneTxt" - }, - "parameters": [ - "__CameraShake.ActualLayerName", - "=", - "\"\"" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Use user defined default values when there is no layer specific value set." - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ - { - "type": { - "value": "CameraShake::SetFrequency" - }, - "parameters": [ - "", - "Variable(__CameraShake.DefaultFrequency)", - "\"\"", - "" - ] - }, - { - "type": { - "value": "ModVarScene" + "value": "NumberVariable" }, "parameters": [ - "__CameraShake.AmplitudeX", - "=", - "Variable(__CameraShake.DefaultAmplitudeX)" + "Time", + "<", + "StartEaseDuration" ] }, { "type": { - "value": "ModVarScene" + "inverted": true, + "value": "NumberVariable" }, "parameters": [ - "__CameraShake.AmplitudeY", - "=", - "Variable(__CameraShake.DefaultAmplitudeY)" - ] - }, - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "__CameraShake.AmplitudeAngle", - "=", - "Variable(__CameraShake.DefaultAmplitudeAngle)" - ] - }, - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "__CameraShake.AmplitudeZoom", - "=", - "Variable(__CameraShake.DefaultAmplitudeZoom)" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "VariableChildExists" - }, - "parameters": [ - "__CameraShake.Layer", - "\"Frequency\"" + "Time", + ">", + "Duration - StopEaseDuration" ] } ], "actions": [ { "type": { - "value": "CameraShake::SetFrequency" + "value": "SetNumberVariable" }, "parameters": [ - "", - "Variable(__CameraShake.Layer.Frequency)", - "\"\"", - "" - ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "VariableChildExists" - }, - "parameters": [ - "__CameraShake.Layer", - "\"AmplitudeX\"" - ] - } - ], - "actions": [ - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "__CameraShake.AmplitudeX", + "EaseFactor", "=", - "Variable(__CameraShake.Layer.AmplitudeX)" + "clamp(Time / StartEaseDuration, 0, 1)" ] } ] @@ -422,245 +288,514 @@ "conditions": [ { "type": { - "value": "VariableChildExists" + "value": "NumberVariable" }, "parameters": [ - "__CameraShake.Layer", - "\"AmplitudeY\"" + "Time", + ">", + "Duration - StopEaseDuration" ] } ], "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.AmplitudeY", + "EaseFactor", "=", - "Variable(__CameraShake.Layer.AmplitudeY)" + "clamp((Duration - Time) / StopEaseDuration, 0, 1)" ] } ] }, { - "type": "BuiltinCommonInstructions::Standard", + "type": "BuiltinCommonInstructions::ForEachChildVariable", + "iterableVariableName": "Layers", + "valueIteratorVariableName": "LayerName", + "keyIteratorVariableName": "LayerName", "conditions": [ { "type": { - "value": "VariableChildExists" + "value": "BooleanVariable" }, "parameters": [ - "__CameraShake.Layer", - "\"AmplitudeAngle\"" + "Layer.Shakable", + "True", + "" ] } ], - "actions": [ + "actions": [], + "events": [ { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "__CameraShake.AmplitudeAngle", - "=", - "Variable(__CameraShake.Layer.AmplitudeAngle)" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "ActualLayerName", + "=", + "LayerName" + ] + } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "VariableChildExists" - }, - "parameters": [ - "__CameraShake.Layer", - "\"AmplitudeZoom\"" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "LayerName", + "=", + "\"__BaseLayer\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "ActualLayerName", + "=", + "\"\"" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "ModVarScene" + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 }, - "parameters": [ - "__CameraShake.AmplitudeZoom", - "=", - "Variable(__CameraShake.Layer.AmplitudeZoom)" + "comment": "Use user defined default values when there is no layer specific value set." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "CameraShake::SetFrequency" + }, + "parameters": [ + "", + "DefaultFrequency", + "\"\"", + "" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AmplitudeX", + "=", + "DefaultAmplitudeX" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AmplitudeY", + "=", + "DefaultAmplitudeY" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AmplitudeAngle", + "=", + "DefaultAmplitudeAngle" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AmplitudeZoom", + "=", + "DefaultAmplitudeZoom" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "VariableChildExists2" + }, + "parameters": [ + "Layer", + "\"Frequency\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "CameraShake::SetFrequency" + }, + "parameters": [ + "", + "Layer.Frequency", + "\"\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "VariableChildExists2" + }, + "parameters": [ + "Layer", + "\"AmplitudeX\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AmplitudeX", + "=", + "Layer.AmplitudeX" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "VariableChildExists2" + }, + "parameters": [ + "Layer", + "\"AmplitudeY\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AmplitudeY", + "=", + "Layer.AmplitudeY" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "VariableChildExists2" + }, + "parameters": [ + "Layer", + "\"AmplitudeAngle\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AmplitudeAngle", + "=", + "Layer.AmplitudeAngle" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "VariableChildExists2" + }, + "parameters": [ + "Layer", + "\"AmplitudeZoom\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "AmplitudeZoom", + "=", + "Layer.AmplitudeZoom" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"AmplitudeZoom: \" + AmplitudeZoom", + "\"info\"", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "Shake the layer camera.\nSave the camera displacement to revert it in onScenePostEvents." + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "AmplitudeX", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Layers[LayerName].CameraDeltaX", + "=", + "CameraShake::Noise2d(\"\", TimeFromStart(), 1000) * AmplitudeX * EaseFactor" + ] + }, + { + "type": { + "value": "SetCameraCenterX" + }, + "parameters": [ + "", + "+", + "Layers[LayerName].CameraDeltaX", + "ActualLayerName", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "AmplitudeY", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Layers[LayerName].CameraDeltaY", + "=", + "CameraShake::Noise2d(\"\", TimeFromStart(), 2000) * AmplitudeY * EaseFactor" + ] + }, + { + "type": { + "value": "SetCameraCenterY" + }, + "parameters": [ + "", + "+", + "Layers[VariableString(LayerName)].CameraDeltaY", + "ActualLayerName", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "AmplitudeAngle", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Layers[LayerName].CameraDeltaAngle", + "=", + "CameraShake::Noise2d(\"\", TimeFromStart(), 3000) * AmplitudeAngle * EaseFactor" + ] + }, + { + "type": { + "value": "SetCameraAngle" + }, + "parameters": [ + "", + "+", + "Layers[LayerName].CameraDeltaAngle", + "ActualLayerName", + "0" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "AmplitudeZoom", + "!=", + "1" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "Layers[LayerName].CameraDeltaZoom", + "=", + "pow(AmplitudeZoom, CameraShake::Noise2d(\"\", TimeFromStart(), 4000) * EaseFactor)" + ] + }, + { + "type": { + "value": "ZoomCamera" + }, + "parameters": [ + "", + "CameraZoom(ActualLayerName, 0) * Layers[LayerName].CameraDeltaZoom", + "ActualLayerName", + "0" + ] + } + ] + } ] } ] + } + ], + "variables": [ + { + "folded": true, + "name": "AmplitudeX", + "type": "number", + "value": 0 }, { - "type": "BuiltinCommonInstructions::Comment", - "color": { - "b": 109, - "g": 230, - "r": 255, - "textB": 0, - "textG": 0, - "textR": 0 - }, - "comment": "Shake the layer camera.\nSave the camera displacement to revert it in onScenePostEvents." + "folded": true, + "name": "AmplitudeY", + "type": "number", + "value": 0 }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "VarScene" - }, - "parameters": [ - "__CameraShake.AmplitudeX", - "!=", - "0" - ] - } - ], - "actions": [ - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "__CameraShake.Layers[VariableString(__CameraShake.LayerName)].CameraDeltaX", - "=", - "CameraShake::Noise2d(\"\", TimeFromStart(), 1000) * Variable(__CameraShake.AmplitudeX) * Variable(__CameraShake.EaseFactor)" - ] - }, - { - "type": { - "value": "SetCameraCenterX" - }, - "parameters": [ - "", - "+", - "Variable(__CameraShake.Layers[VariableString(__CameraShake.LayerName)].CameraDeltaX)", - "VariableString(__CameraShake.ActualLayerName)", - "0" - ] - } - ] + "folded": true, + "name": "AmplitudeAngle", + "type": "number", + "value": 0 }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "VarScene" - }, - "parameters": [ - "__CameraShake.AmplitudeY", - "!=", - "0" - ] - } - ], - "actions": [ - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "__CameraShake.Layers[VariableString(__CameraShake.LayerName)].CameraDeltaY", - "=", - "CameraShake::Noise2d(\"\", TimeFromStart(), 2000) * Variable(__CameraShake.AmplitudeY) * Variable(__CameraShake.EaseFactor)" - ] - }, - { - "type": { - "value": "SetCameraCenterY" - }, - "parameters": [ - "", - "+", - "Variable(__CameraShake.Layers[VariableString(__CameraShake.LayerName)].CameraDeltaY)", - "VariableString(__CameraShake.ActualLayerName)", - "0" - ] - } - ] + "folded": true, + "name": "AmplitudeZoom", + "type": "number", + "value": 0 }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "VarScene" - }, - "parameters": [ - "__CameraShake.AmplitudeAngle", - "!=", - "0" - ] - } - ], - "actions": [ - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "__CameraShake.Layers[VariableString(__CameraShake.LayerName)].CameraDeltaAngle", - "=", - "CameraShake::Noise2d(\"\", TimeFromStart(), 3000) * Variable(__CameraShake.AmplitudeAngle) * Variable(__CameraShake.EaseFactor)" - ] - }, - { - "type": { - "value": "SetCameraAngle" - }, - "parameters": [ - "", - "+", - "Variable(__CameraShake.Layers[VariableString(__CameraShake.LayerName)].CameraDeltaAngle)", - "VariableString(__CameraShake.ActualLayerName)", - "0" - ] - } - ] + "folded": true, + "name": "EaseFactor", + "type": "number", + "value": 1 }, { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ - { - "type": { - "value": "VarScene" - }, - "parameters": [ - "__CameraShake.AmplitudeZoom", - "!=", - "1" - ] - } - ], - "actions": [ - { - "type": { - "value": "ModVarScene" - }, - "parameters": [ - "__CameraShake.Layers[VariableString(__CameraShake.LayerName)].CameraDeltaZoom", - "=", - "pow(Variable(__CameraShake.AmplitudeZoom), CameraShake::Noise2d(\"\", TimeFromStart(), 4000) * Variable(__CameraShake.EaseFactor))" - ] - }, - { - "type": { - "value": "ZoomCamera" - }, - "parameters": [ - "", - "CameraZoom(VariableString(__CameraShake.ActualLayerName), 0) * Variable(__CameraShake.Layers[VariableString(__CameraShake.LayerName)].CameraDeltaZoom)", - "VariableString(__CameraShake.ActualLayerName)", - "0" - ] - } - ] + "folded": true, + "name": "ActualLayerName", + "type": "string", + "value": "" } ] } @@ -704,181 +839,256 @@ "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::ForEachChildVariable", - "iterableVariableName": "__CameraShake.Layers", - "valueIteratorVariableName": "__CameraShake.Layer", - "keyIteratorVariableName": "__CameraShake.LayerName", - "conditions": [ - { - "type": { - "value": "SceneVariableAsBoolean" - }, - "parameters": [ - "__CameraShake.Layers[VariableString(__CameraShake.LayerName)].Shakable", - "True" - ] - } - ], + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], "actions": [], "events": [ { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [], - "actions": [ + "type": "BuiltinCommonInstructions::ForEachChildVariable", + "iterableVariableName": "Layers", + "valueIteratorVariableName": "Layer", + "keyIteratorVariableName": "LayerName", + "conditions": [ { "type": { - "value": "ModVarSceneTxt" + "value": "BooleanVariable" }, "parameters": [ - "__CameraShake.ActualLayerName", - "=", - "VariableString(__CameraShake.LayerName)" + "Layer.Shakable", + "True", + "" ] } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + ], + "actions": [ { "type": { - "value": "VarSceneTxt" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.LayerName", + "CameraDeltaX", "=", - "\"__BaseLayer\"" + "Layer.CameraDeltaX" ] - } - ], - "actions": [ + }, { "type": { - "value": "ModVarSceneTxt" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.ActualLayerName", + "CameraDeltaY", "=", - "\"\"" + "Layer.CameraDeltaY" ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { "type": { - "value": "VarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.AmplitudeX", - "!=", - "0" + "CameraDeltaAngle", + "=", + "Layer.CameraDeltaAngle" ] - } - ], - "actions": [ + }, { "type": { - "value": "SetCameraCenterX" + "value": "SetNumberVariable" }, "parameters": [ - "", - "-", - "Variable(__CameraShake.Layers[VariableString(__CameraShake.LayerName)].CameraDeltaX)", - "VariableString(__CameraShake.ActualLayerName)", - "0" + "CameraDeltaZoom", + "=", + "Layer.CameraDeltaZoom" ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { "type": { - "value": "VarScene" + "value": "SetStringVariable" }, "parameters": [ - "__CameraShake.AmplitudeY", - "!=", - "0" + "ActualLayerName", + "=", + "LayerName" ] } ], - "actions": [ + "events": [ { - "type": { - "value": "SetCameraCenterY" - }, - "parameters": [ - "", - "-", - "Variable(__CameraShake.Layers[VariableString(__CameraShake.LayerName)].CameraDeltaY)", - "VariableString(__CameraShake.ActualLayerName)", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "StringVariable" + }, + "parameters": [ + "LayerName", + "=", + "\"__BaseLayer\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "ActualLayerName", + "=", + "\"\"" + ] + } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "VarScene" - }, - "parameters": [ - "__CameraShake.AmplitudeAngle", - "!=", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CameraDeltaX", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetCameraCenterX" + }, + "parameters": [ + "", + "-", + "CameraDeltaX", + "ActualLayerName", + "0" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "SetCameraAngle" - }, - "parameters": [ - "", - "-", - "Variable(__CameraShake.Layers[VariableString(__CameraShake.LayerName)].CameraDeltaAngle)", - "VariableString(__CameraShake.ActualLayerName)", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CameraDeltaY", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetCameraCenterY" + }, + "parameters": [ + "", + "-", + "CameraDeltaY", + "ActualLayerName", + "0" + ] + } ] - } - ] - }, - { - "type": "BuiltinCommonInstructions::Standard", - "conditions": [ + }, { - "type": { - "value": "VarScene" - }, - "parameters": [ - "__CameraShake.AmplitudeZoom", - "!=", - "1" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CameraDeltaAngle", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetCameraAngle" + }, + "parameters": [ + "", + "-", + "CameraDeltaAngle", + "ActualLayerName", + "0" + ] + } ] - } - ], - "actions": [ + }, { - "type": { - "value": "ZoomCamera" - }, - "parameters": [ - "", - "CameraZoom(VariableString(__CameraShake.ActualLayerName), 0) / Variable(__CameraShake.Layers[VariableString(__CameraShake.LayerName)].CameraDeltaZoom)", - "VariableString(__CameraShake.ActualLayerName)", - "0" + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "NumberVariable" + }, + "parameters": [ + "CameraDeltaZoom", + "!=", + "0" + ] + } + ], + "actions": [ + { + "type": { + "value": "ZoomCamera" + }, + "parameters": [ + "", + "CameraZoom(ActualLayerName) / CameraDeltaZoom", + "ActualLayerName", + "0" + ] + } ] } ] } + ], + "variables": [ + { + "folded": true, + "name": "ActualLayerName", + "type": "string", + "value": "" + }, + { + "folded": true, + "name": "CameraDeltaX", + "type": "number", + "value": 0 + }, + { + "folded": true, + "name": "CameraDeltaY", + "type": "number", + "value": 0 + }, + { + "folded": true, + "name": "CameraDeltaAngle", + "type": "number", + "value": 0 + }, + { + "folded": true, + "name": "CameraDeltaZoom", + "type": "number", + "value": 0 + } ] } ] @@ -900,42 +1110,42 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Time", + "Time", "=", "0" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Duration", + "Duration", "=", - "Duration" + "NewDuration" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.StartEaseDuration", + "StartEaseDuration", "=", - "StartEaseDuration" + "NewStartEaseDuration" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.StopEaseDuration", + "StopEaseDuration", "=", - "StopEaseDuration" + "NewStopEaseDuration" ] } ] @@ -945,34 +1155,50 @@ "conditions": [ { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ - "__CameraShake.Duration", + "Duration", "<", - "Variable(__CameraShake.StartEaseDuration) + Variable(__CameraShake.StopEaseDuration)" + "StartEaseDuration + StopEaseDuration" ] } ], "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.StartEaseDuration", + "StartEaseDuration", "=", - "StartEaseDuration * Variable(__CameraShake.Duration) / (StartEaseDuration + StopEaseDuration)" + "StartEaseDuration * Duration / (StartEaseDuration + StopEaseDuration)" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.StopEaseDuration", + "StopEaseDuration", "=", - "StopEaseDuration * Variable(__CameraShake.Duration) / (StartEaseDuration + StopEaseDuration)" + "StopEaseDuration * Duration / (StartEaseDuration + StopEaseDuration)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "DebuggerTools::ConsoleLog" + }, + "parameters": [ + "\"Start Shake\"", + "\"info\"", + "" ] } ] @@ -981,17 +1207,17 @@ "parameters": [ { "description": "Duration (in seconds)", - "name": "Duration", + "name": "NewDuration", "type": "expression" }, { "description": "Ease duration to start (in seconds)", - "name": "StartEaseDuration", + "name": "NewStartEaseDuration", "type": "expression" }, { "description": "Ease duration to stop (in seconds)", - "name": "StopEaseDuration", + "name": "NewStopEaseDuration", "type": "expression" } ], @@ -1020,10 +1246,10 @@ "actions": [ { "type": { - "value": "VariableClearChildren" + "value": "ClearVariableChildren" }, "parameters": [ - "__CameraShake.Layers" + "Layers" ] }, { @@ -1045,90 +1271,90 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Time", + "Time", "=", "0" ] }, { "type": { - "value": "ModVarSceneTxt" + "value": "SetStringVariable" }, "parameters": [ - "__CameraShake.Layer", + "Layer", "=", "GetArgumentAsString(\"Layer\")" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Duration", + "Duration", "=", "GetArgumentAsNumber(\"Duration\")" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.StartEaseDuration", + "StartEaseDuration", "=", "0" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.StopEaseDuration", + "StopEaseDuration", "=", "GetArgumentAsNumber(\"Duration\")" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.DefaultAmplitudeX", + "DefaultAmplitudeX", "=", "abs(GetArgumentAsNumber(\"AmplitudeX\"))" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.DefaultAmplitudeY", + "DefaultAmplitudeY", "=", "abs(GetArgumentAsNumber(\"AmplitudeY\"))" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.DefaultAmplitudeAngle", + "DefaultAmplitudeAngle", "=", "GetArgumentAsNumber(\"AmplitudeAngle\")" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.DefaultAmplitudeZoom", + "DefaultAmplitudeZoom", "=", "1 + GetArgumentAsNumber(\"AmplitudeZoom\") / 100" ] @@ -1152,10 +1378,10 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.DefaultFrequency", + "DefaultFrequency", "=", "1 / GetArgumentAsNumber(\"ShakePeriod\")" ] @@ -1179,10 +1405,10 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.DefaultFrequency", + "DefaultFrequency", "=", "1 / 0.08" ] @@ -1218,10 +1444,10 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Duration", + "Duration", "=", "1234567890" ] @@ -1245,10 +1471,10 @@ "conditions": [ { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ - "__CameraShake.Duration", + "Duration", "=", "0" ] @@ -1257,10 +1483,10 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Duration", + "Duration", "=", "0.5" ] @@ -1334,30 +1560,30 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Time", + "Time", "=", "0" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Duration", + "Duration", "=", "1234567890" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.StartEaseDuration", + "StartEaseDuration", "=", "EaseDuration" ] @@ -1387,30 +1613,30 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Time", + "Time", "=", "0" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Duration", + "Duration", "=", "EaseDuration" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.StopEaseDuration", + "StopEaseDuration", "=", "EaseDuration" ] @@ -1441,12 +1667,12 @@ "actions": [ { "type": { - "value": "ModVarSceneTxt" + "value": "SetStringVariable" }, "parameters": [ - "__CameraShake.LayerName", + "LayerName", "=", - "Layer" + "NewLayerName" ] } ] @@ -1459,7 +1685,7 @@ "value": "BuiltinCommonInstructions::CompareStrings" }, "parameters": [ - "Layer", + "NewLayerName", "=", "\"\"" ] @@ -1468,10 +1694,10 @@ "actions": [ { "type": { - "value": "ModVarSceneTxt" + "value": "SetStringVariable" }, "parameters": [ - "__CameraShake.LayerName", + "LayerName", "=", "\"__BaseLayer\"" ] @@ -1494,11 +1720,12 @@ "actions": [ { "type": { - "value": "SetSceneVariableAsBoolean" + "value": "SetBooleanVariable" }, "parameters": [ - "__CameraShake.Layers[VariableString(__CameraShake.LayerName)].Shakable", - "=" + "Layers[LayerName].Shakable", + "False", + "" ] } ] @@ -1518,11 +1745,12 @@ "actions": [ { "type": { - "value": "SetSceneVariableAsBoolean" + "value": "SetBooleanVariable" }, "parameters": [ - "__CameraShake.Layers[VariableString(__CameraShake.LayerName)].Shakable", - "True" + "Layers[LayerName].Shakable", + "True", + "" ] } ] @@ -1538,7 +1766,7 @@ }, { "description": "Layer", - "name": "Layer", + "name": "NewLayerName", "type": "layer" } ], @@ -1556,12 +1784,12 @@ "conditions": [ { "type": { - "value": "VarScene" + "value": "NumberVariable" }, "parameters": [ - "__CameraShake.Time", + "Time", "<", - "Variable(__CameraShake.Duration)" + "Duration" ] } ], @@ -1594,12 +1822,12 @@ "actions": [ { "type": { - "value": "ModVarSceneTxt" + "value": "SetStringVariable" }, "parameters": [ - "__CameraShake.LayerName", + "LayerName", "=", - "Layer" + "NewLayerName" ] } ] @@ -1612,7 +1840,7 @@ "value": "BuiltinCommonInstructions::CompareStrings" }, "parameters": [ - "Layer", + "NewLayerName", "=", "\"\"" ] @@ -1621,10 +1849,10 @@ "actions": [ { "type": { - "value": "ModVarSceneTxt" + "value": "SetStringVariable" }, "parameters": [ - "__CameraShake.LayerName", + "LayerName", "=", "\"__BaseLayer\"" ] @@ -1637,20 +1865,20 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Layers[VariableString(__CameraShake.LayerName)].AmplitudeX", + "Layers[LayerName].AmplitudeX", "=", "AmplitudeX" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Layers[VariableString(__CameraShake.LayerName)].AmplitudeY", + "Layers[LayerName].AmplitudeY", "=", "AmplitudeY" ] @@ -1671,7 +1899,7 @@ }, { "description": "Layer", - "name": "Layer", + "name": "NewLayerName", "type": "layer" } ], @@ -1691,12 +1919,12 @@ "actions": [ { "type": { - "value": "ModVarSceneTxt" + "value": "SetStringVariable" }, "parameters": [ - "__CameraShake.LayerName", + "LayerName", "=", - "Layer" + "NewLayerName" ] } ] @@ -1709,7 +1937,7 @@ "value": "BuiltinCommonInstructions::CompareStrings" }, "parameters": [ - "Layer", + "NewLayerName", "=", "\"\"" ] @@ -1718,10 +1946,10 @@ "actions": [ { "type": { - "value": "ModVarSceneTxt" + "value": "SetStringVariable" }, "parameters": [ - "__CameraShake.LayerName", + "LayerName", "=", "\"__BaseLayer\"" ] @@ -1734,10 +1962,10 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Layers[VariableString(__CameraShake.LayerName)].AmplitudeAngle", + "Layers[LayerName].AmplitudeAngle", "=", "AmplitudeAngle" ] @@ -1752,8 +1980,8 @@ "type": "expression" }, { - "description": "Layer", - "name": "Layer", + "description": "NewLayerName", + "name": "NewLayerName", "type": "layer" } ], @@ -1773,12 +2001,12 @@ "actions": [ { "type": { - "value": "ModVarSceneTxt" + "value": "SetStringVariable" }, "parameters": [ - "__CameraShake.LayerName", + "LayerName", "=", - "GetArgumentAsString(\"Layer\")" + "NewLayerName" ] } ] @@ -1791,7 +2019,7 @@ "value": "BuiltinCommonInstructions::CompareStrings" }, "parameters": [ - "Layer", + "NewLayerName", "=", "\"\"" ] @@ -1800,10 +2028,10 @@ "actions": [ { "type": { - "value": "ModVarSceneTxt" + "value": "SetStringVariable" }, "parameters": [ - "__CameraShake.LayerName", + "LayerName", "=", "\"__BaseLayer\"" ] @@ -1816,12 +2044,12 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Layers[VariableString(__CameraShake.LayerName)].AmplitudeZoom", + "Layers[LayerName].AmplitudeZoom", "=", - "GetArgumentAsNumber(\"AmplitudeZoom\")" + "AmplitudeZoom" ] } ] @@ -1834,8 +2062,8 @@ "type": "expression" }, { - "description": "Layer", - "name": "Layer", + "description": "NewLayerName", + "name": "NewLayerName", "type": "layer" } ], @@ -1855,12 +2083,12 @@ "actions": [ { "type": { - "value": "ModVarSceneTxt" + "value": "SetStringVariable" }, "parameters": [ - "__CameraShake.LayerName", + "LayerName", "=", - "GetArgumentAsString(\"Layer\")" + "NewLayerName" ] } ] @@ -1873,7 +2101,7 @@ "value": "BuiltinCommonInstructions::CompareStrings" }, "parameters": [ - "Layer", + "NewLayerName", "=", "\"\"" ] @@ -1882,10 +2110,10 @@ "actions": [ { "type": { - "value": "ModVarSceneTxt" + "value": "SetStringVariable" }, "parameters": [ - "__CameraShake.LayerName", + "LayerName", "=", "\"__BaseLayer\"" ] @@ -1898,12 +2126,12 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.Layers[VariableString(__CameraShake.LayerName)].Frequency", + "Layers[LayerName].Frequency", "=", - "GetArgumentAsNumber(\"Frequency\")" + "Frequency" ] } ] @@ -1916,8 +2144,8 @@ "type": "expression" }, { - "description": "Layer", - "name": "Layer", + "description": "NewLayerName", + "name": "NewLayerName", "type": "layer" } ], @@ -1937,20 +2165,20 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.DefaultAmplitudeX", + "DefaultAmplitudeX", "=", "AmplitudeX" ] }, { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.DefaultAmplitudeY", + "DefaultAmplitudeY", "=", "AmplitudeY" ] @@ -1986,10 +2214,10 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.DefaultAmplitudeAngle", + "DefaultAmplitudeAngle", "=", "AmplitudeAngle" ] @@ -2020,10 +2248,10 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.DefaultAmplitudeZoom", + "DefaultAmplitudeZoom", "=", "AmplitudeZoom" ] @@ -2054,10 +2282,10 @@ "actions": [ { "type": { - "value": "ModVarScene" + "value": "SetNumberVariable" }, "parameters": [ - "__CameraShake.DefaultFrequency", + "DefaultFrequency", "=", "Frequency" ]