Animation Blocks

Basic Animation

{"func":"blockAnimationSimpleSwitchCostume"}

Animate

"Animate" animates the character for one animation cycle.

Parameters:

Animation: The animation to perform.

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostumeAndWait"} ,     {"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerFlagTrigger","next":{"func":"blockControlForever","containers":[{"func":"blockControlIfElse","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"containers":[{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Jump"}]},{"func":"blockAnimationSimpleSwitchCostume","values":[{"type":"string","value":"Idle"}]}],"containerLabels":[{"type":"wrapper","func":"nop","values":[],"labelText":"else {button:add}"}]}]}} Add to my Backpack


{"func":"blockAnimationSimpleSwitchCostumeAndWait"}

Animate And Wait

"Animate" animates the character for one animation cycle and waits.

Parameters:

Animation: The animation to perform.

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostume"} ,     {"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerKeyTrigger","values":[{"type":"choice","value":"right arrow"}],"next":{"func":"blockMotionPointDirection","values":[{"type":"string","value":"90"}],"next":{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Walk"}]}}} Add to my Backpack


{"func":"blockAnimationSetSpeed"}

Set Animation Speed

"Set Animation Speed" sets the speed of the character’s animations.

Parameters:

Value: This is the percentage of the normal animation speed to set the speed to.

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostume"} ,     {"func":"blockAnimationSimpleSwitchCostumeAndWait"} ,     {"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"slow motion"}],"next":{"func":"blockAnimationSetSpeed","values":[{"type":"number","value":20}],"next":{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Walk"}],"next":{"func":"blockAnimationSetSpeed","values":[{"type":"number","value":"100"}]}}}} Add to my Backpack


{"func":"blockAnimationAnimate"}

Animate With Name

Animate the character.

Parameters:

Animation: The animation to perform.

FPS: Frames per second to play the animation at.

Time: The time to perform the animation.

Name: What to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostume"} ,     {"func":"blockAnimationSimpleSwitchCostumeAndWait"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"slow motion"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Run"},{"type":"number","value":10},{"type":"number","value":3},{"type":"string","value":"slow run"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"slow run"}],"next":{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Run"}]}}}} Add to my Backpack


Character Parts

{"func":"blockLooksSetCharacterPart"}

Set Part

Sets a character part.

Parameters:

Part: This is the part of the character to change.

Skin: This is the character skin to change the part into.

Related Blocks:
{"func":"valueLooksGetCharacterPart"}

Sample Code:
{"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingTouchingSprite","values":[{"type":"string","value":"helmet"}]}],"next":{"func":"blockLooksSetCharacterPart","values":[{"type":"string","value":"Head"},{"type":"string","value":"knight"}]}} Add to my Backpack


{"func":"valueLooksGetCharacterPart"}

Get Part

Get a character part.

Parameters:

Part: This is the character part to retrieve.

Related Blocks:
{"func":"blockLooksSetCharacterPart"}

Sample Code:
{"func":"registerKeyTrigger","values":[{"type":"choice","value":"a"}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueOpEqual","values":[{"type":"wrapper","func":"valueLooksGetCharacterPart","values":[{"type":"string","value":"Right Props"}]},{"type":"string","value":"knight"}]}],"containers":[{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Attack 1"}]}]}} Add to my Backpack


Animation Control

{"func":"blockAnimationWaitFor"}

Wait for Animation

"Wait for Animation" pauses the script until the named animation is finished.

Parameters:

Animation: This is the name of the animation to wait for.

Related Blocks:
{"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"slow motion"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Run"},{"type":"number","value":10},{"type":"number","value":3},{"type":"string","value":"slow run"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"slow run"}],"next":{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Run"}]}}}} Add to my Backpack


{"func":"blockAnimationStop"}

Stop Animation

"Stop Animation" stops the named animation.

Parameters:

Animation: This is the name of the animation to stop.

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostume"} ,     {"func":"blockAnimationSimpleSwitchCostumeAndWait"}

Sample Code:
{"func":"registerTrigger","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"next":{"func":"blockControlWhile","values":[{"type":"wrapper","func":"valueSensingMouseDown"}],"containers":[{"func":"blockAnimationSimpleSwitchCostume","values":[{"type":"string","value":"Run"}]}],"next":{"func":"blockAnimationStop","values":[{"type":"string","value":"Run"}]}}} Add to my Backpack


{"func":"valueAnimationTime"}

Animation Time

"Animation Time" returns the time it takes for an animation to go for one cycle.

Parameters:

Animation: This is the name of the animation to get the length of.

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostume"} ,     {"func":"blockAnimationSimpleSwitchCostumeAndWait"} ,     {"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"walk"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Walk"},{"type":"number","value":"30"},{"type":"wrapper","func":"valueOpMultiply","values":[{"type":"wrapper","func":"valueAnimationTime","values":[{"type":"string","value":"Walk"}]},{"type":"number","value":3}]},{"type":"string","value":"walk"}],"next":{"func":"blockAnimationSimpleMoveTo","values":[{"type":"wrapper","func":"valueOpBinary","values":[{"type":"wrapper","func":"valueMotionXPosition"},{"type":"choice","value":"+"},{"type":"string","value":"100"}]},{"type":"wrapper","func":"valueMotionYPosition"},{"type":"wrapper","func":"valueOpMultiply","values":[{"type":"wrapper","func":"valueAnimationTime","values":[{"type":"string","value":"Walk"}]},{"type":"number","value":3}]},{"type":"string","value":"walk"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"walk"}]}}}} Add to my Backpack


{"func":"valueAnimationIsRunning"}

Is Animation Running?

"Is Animation Running?" checks to see if the animation is running.

Parameters:

Animation: This is the animation to test for whether it is running or not.

Related Blocks:
{"func":"blockAnimationSimpleSwitchCostume"} ,     {"func":"blockAnimationSimpleSwitchCostumeAndWait"} ,     {"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"stop walking"}],"next":{"func":"blockControlIf","values":[{"type":"wrapper","func":"valueAnimationIsRunning","values":[{"type":"string","value":"Walk"}]}],"containers":[{"func":"blockAnimationStop","values":[{"type":"string","value":"Walk"}]}]}} Add to my Backpack


{"func":"registerAnimationDone"}

When Animation Done

When the specified animation is done, this script will be triggered.

Parameters:

Name: This is the name of the animation that will trigger the script.

Related Blocks:
{"func":"blockAnimationAnimate"}

Sample Code:
{"func":"registerAnimationDone","values":[{"type":"string","value":"jump"}],"next":{"func":"blockAnimationSimpleSwitchCostumeAndWait","values":[{"type":"string","value":"Flip"}]}} Add to my Backpack


Advanced Animation

{"func":"blockAnimationSimpleMoveBy"}

Animate Move By

"Animate Move By" moves this Actor by the specified X and Y in the given time.

Parameters:

X: This is how far to move in the X direction.

Y: This is how far to move in the Y direction.

Time: This is the time it takes to move to the specified position.

Name: This is what to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleMoveTo"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"walk"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Walk"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"walk"}],"next":{"func":"blockAnimationSimpleMoveBy","values":[{"type":"wrapper","func":"valueOpBinary","values":[{"type":"wrapper","func":"valueMotionXPosition"},{"type":"choice","value":"+"},{"type":"string","value":"100"}]},{"type":"wrapper","func":"valueMotionYPosition"},{"type":"number","value":"1"},{"type":"string","value":"walk"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"walk"}]}}}} Add to my Backpack


{"func":"blockAnimationSimpleMoveTo"}

Animate Move To

"Animate Move To" moves this Actor to the specified X and Y in the given time.

Parameters:

X: This is the X position to move to.

Y: This is the Y position to move to.

Time: This is the time it takes to move to the specified position.

Name: This is what to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleMoveBy"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"walk"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Walk"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"walk"}],"next":{"func":"blockAnimationSimpleMoveTo","values":[{"type":"wrapper","func":"valueOpBinary","values":[{"type":"wrapper","func":"valueMotionXPosition"},{"type":"choice","value":"+"},{"type":"string","value":"100"}]},{"type":"wrapper","func":"valueMotionYPosition"},{"type":"number","value":"1"},{"type":"string","value":"walk"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"walk"}]}}}} Add to my Backpack


{"func":"blockAnimationSimpleScaleBy"}

Animate Scaling By

"Animate Scaling By" scales this Actor by the specified value in the given time.

Parameters:

Scale: This is the amount to scale by.

Time: This is the time it takes to scale by the specified amount.

Name: This is what to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleScaleTo"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"grow"}],"next":{"func":"blockAnimationSimpleScaleBy","values":[{"type":"number","value":50},{"type":"number","value":"1"},{"type":"string","value":"grow"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"grow"}]}}} Add to my Backpack


{"func":"blockAnimationSimpleScaleTo"}

Animate Scaling To

"Animate Scaling To" scales this Actor to the specified value in the given time.

Parameters:

Scale: This is the amount to scale to.

Time: This is the time it takes to scale to the specified size.

Name: This is what to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleScaleBy"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"grow"}],"next":{"func":"blockAnimationSimpleScaleTo","values":[{"type":"number","value":100},{"type":"number","value":"1"},{"type":"string","value":"grow"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"grow"}]}}} Add to my Backpack


{"func":"blockAnimationSimpleRotateBy"}

Animate Rotation By

"Animate Rotation By" animates the rotation of the Actor by the specified angle.

Parameters:

Angle: This is the amount to rotate by. Use a negative value to rotate the other direction.

Time: This is the time it takes to rotate to the specified angle.

Name: This is what to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleRotateTo"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"turn"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Idle"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"turn"}],"next":{"func":"blockAnimationSimpleRotateBy","values":[{"type":"number","value":45},{"type":"number","value":"1"},{"type":"string","value":"turn"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"turn"}]}}}} Add to my Backpack


{"func":"blockAnimationSimpleRotateTo"}

Animate Rotation To

"Animate Rotation To" animates the rotation of the Actor to the specified angle.

Parameters:

Angle: This is the angle to rotate to.

Time: This is the time it takes to rotate to the specified angle.

Name: This is what to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleRotateBy"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"turn"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Idle"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"turn"}],"next":{"func":"blockAnimationSimpleRotateTo","values":[{"type":"number","value":90},{"type":"number","value":"1"},{"type":"string","value":"turn"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"turn"}]}}}} Add to my Backpack


{"func":"blockAnimationSimpleBezierBy"}

Animate Bezier Curve By

"Animate Bezier Curve By" animates a bezier curve to the new position.

Parameters:

X, Y: This is the ending position relative to the Actor's current position.

CX1, CY1: This is the first control point of the curve.

CX2, CY2: This is the second control point of the curve.

Time: This is the time it takes to perform the curve.

Name: This is what to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleBezierTo"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"jump"}],"next":{"func":"blockMotionGoTo","values":[{"type":"number","value":-50},{"type":"number","value":-150}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Jump"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"jump"}],"next":{"func":"blockAnimationSimpleBezierBy","values":[{"type":"number","value":100},{"type":"number","value":0},{"type":"number","value":-5},{"type":"number","value":75},{"type":"number","value":40},{"type":"number","value":150},{"type":"number","value":"1"},{"type":"string","value":""}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"jump"}]}}}}} Add to my Backpack


{"func":"blockAnimationSimpleBezierTo"}

Animate Bezier Curve To

"Animate Bezier Curve By" animates a bezier curve to the end position.

Parameters:

X, Y: This is the ending position.

CX1, CY1: This is the first control point of the curve.

CX2, CY2: This is the second control point of the curve.

Time: This is the time it takes to perform the curve.

Name: This is what to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleBezierBy"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"jump"}],"next":{"func":"blockMotionGoTo","values":[{"type":"number","value":-50},{"type":"number","value":-150}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Jump"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"jump"}],"next":{"func":"blockAnimationSimpleBezierTo","values":[{"type":"number","value":50},{"type":"number","value":-150},{"type":"number","value":-25},{"type":"number","value":-75},{"type":"number","value":0},{"type":"number","value":0},{"type":"number","value":"1"},{"type":"string","value":"jump"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"jump"}]}}}}} Add to my Backpack


{"func":"blockAnimationSimpleEffectBy"}

Animate Effect By

"Animate Effect By" performs an effect animation relative to the current effect value.

Parameters:

Effect: This is the effect to animate.

Value: This is the amount of the effect to animate by.

Time: This is the time it takes to perform the effect.

Name: This is what to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleEffectTo"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"fade"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Fall Die"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"fade"}],"next":{"func":"blockAnimationSimpleEffectBy","values":[{"type":"choice","value":"ghost"},{"type":"number","value":"25"},{"type":"number","value":"1"},{"type":"string","value":""}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"fade"}]}}}} Add to my Backpack


{"func":"blockAnimationSimpleEffectTo"}

Animate Effect To

"Animate Effect By" performs an effect animation.

Parameters:

Effect: This is the effect to animate.

Value: This is the amount of the effect to animate to.

Time: This is the time it takes to perform the effect.

Name: This is what to call this animation.

Related Blocks:
{"func":"blockAnimationSimpleEffectBy"}

Sample Code:
{"func":"registerBroadcastTrigger","values":[{"type":"string","value":"fade"}],"next":{"func":"blockAnimationAnimate","values":[{"type":"string","value":"Fall Die"},{"type":"number","value":"30"},{"type":"number","value":"1"},{"type":"string","value":"fade"}],"next":{"func":"blockAnimationSimpleEffectTo","values":[{"type":"choice","value":"color"},{"type":"number","value":1},{"type":"number","value":"1"},{"type":"string","value":"fade"}],"next":{"func":"blockAnimationWaitFor","values":[{"type":"string","value":"fade"}]}}}} Add to my Backpack