MakeCode Games!

A fan-made community library of MakeCode Arcade games. Visit MakeCode Arcade to make a game!

← Back to extensions

Sprite Utils

A grab-bag of sprite math and rendering helpers for MakeCode Arcade: distances, angles, movement, timers, and simple drawing.

apply transform to sprite image

Problem it solves

You want to flip or rotate a sprite's image—for example to face the other direction—without redrawing it by hand.

What this block does

Flips or rotates a sprite's current image in place: horizontal flip, vertical flip, or a 90/180/270 degree clockwise rotation.

The block

Block ID: spriteutiltransformspriteimage

apply $transform to $sprite image block

Parameters

NameTypeDefaultMeaning
spriteSpritemySpriteThe sprite to transform
transformImageTransformflip horizontal, flip vertical, or rotate 90/180/270 degrees clockwise

Example

let mySprite = sprites.create(img`.`, SpriteKind.Player)
let myEnemy = sprites.create(img`.`, SpriteKind.Enemy)
spriteutils.transformSpriteImage(mySprite, spriteutils.ImageTransform.FlipHorizontal)

Add the extension

Add github:jwunderl/arcade-sprite-util to your project, or open: Import arcade-sprite-util.