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.

draw transparent image

Problem it solves

You want to stamp one image onto another (like an icon onto the screen) without the source image's background color covering what's underneath.

What this block does

Draws src onto to, treating the source's transparent pixels as transparent, with its top-left corner at (x, y).

The block

Block ID: spriteutilextdrawtransparentimg

draw $src to $to at x $x y $y block

Parameters

NameTypeDefaultMeaning
srcImageThe image to draw
toImagemyImageThe image to draw onto
xnumberLeft position
ynumberTop position

Example

let myImage = image.create(160, 120)
spriteutils.drawTransparentImage(img`.`, myImage, 10, 10)

Add the extension

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