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
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| src | Image | — | The image to draw |
| to | Image | myImage | The image to draw onto |
| x | number | — | Left position |
| y | number | — | Top 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.