place angle from
Problem it solves
You want to drop a sprite at an exact spot relative to another sprite—like spawning an orbiting shield a fixed distance from the player at a specific angle.
What this block does
Moves spriteToMove so it sits a given distance away from fromSprite, at the given angle in radians.
The block
Block ID: spriteutilextplaceanglefrom
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| spriteToMove | Sprite | myEnemy | The sprite to reposition |
| angleInRadians | number | — | The angle away from fromSprite |
| distance | number | — | How far away to place spriteToMove, in pixels |
| fromSprite | Sprite / Location / Point | mySprite | The sprite to measure from |
Example
let mySprite = sprites.create(img`.`, SpriteKind.Player) let myEnemy = sprites.create(img`.`, SpriteKind.Enemy) spriteutils.placeAngleFrom(myEnemy, Math.PI / 2, 40, mySprite)
Add the extension
Add github:jwunderl/arcade-sprite-util to your project, or open: Import arcade-sprite-util.