get Sprite attribute
Problem it solves
You need to check how high an enemy is in the air before triggering a ground-slam attack.
What this block does
Reads the current vertical 3D attribute (ZOffset, ZPosition, ZVelocity, or ZAcceleration) of a sprite.
The block
Block ID: rcRender_getSpriteAttribute
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| spr | Sprite | mySprite | The sprite to inspect. |
| attr | RCSpriteAttribute | The 3D attribute to retrieve. |
Returns
number — The value of the requested vertical attribute in pixels or pixels per second.
Example
let mySprite = sprites.create(img`.`, SpriteKind.Player) let zPos = Render.getSpriteAttribute(mySprite, RCSpriteAttribute.ZPosition)
Add the extension
Add github:The-Code-Zone/Raycasting-pxt-extension to your project, or open: Import Raycasting-pxt-extension.