create animations
Problem it solves
You want an enemy or character to show different sprites depending on which angle the player is viewing them from in the 3D world.
What this block does
Creates a directional animation package from 1 to 4 sets of animation frames. Directions are evenly distributed in clockwise order starting from facing left.
The block
Block ID: create_animation
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| frameInterval | number | 150 | Time between animation frame flips in milliseconds. |
| frames1 | Image[] | The first animation frames list (faces left by default). | |
| frames2 | Image[] | Optional second animation frames list (for right or front view). | |
| frames3 | Image[] | Optional third animation frames list (for right view in 4-way setup). | |
| frames4 | Image[] | Optional fourth animation frames list (for back view in 4-way setup). |
Returns
Animations — A directional Animations object ready to assign to sprites.
Example
let anim = Render.createAnimations(150, [img`.`], [img`.`]) let enemy = sprites.create(img`.`, SpriteKind.Enemy) Render.setSpriteAnimations(enemy, anim)
Add the extension
Add github:The-Code-Zone/Raycasting-pxt-extension to your project, or open: Import Raycasting-pxt-extension.