set Sprite attribute
Problem it solves
You want to manually set an enemy's vertical gravity, height position, or upward velocity in 3D.
What this block does
Updates vertical 3D physics attributes (ZOffset, ZPosition, ZVelocity, or ZAcceleration) for a given sprite.
The block
Block ID: rcRender_setSpriteAttribute
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| spr | Sprite | mySprite | The sprite to modify. |
| attr | RCSpriteAttribute | The 3D attribute to change (ZOffset, ZPosition, ZVelocity, or ZAcceleration). | |
| value | number | The numerical value to assign. |
Returns
void — Nothing.
Example
let mySprite = sprites.create(img`.`, SpriteKind.Player) Render.setSpriteAttribute(mySprite, RCSpriteAttribute.ZOffset, 4)
Add the extension
Add github:The-Code-Zone/Raycasting-pxt-extension to your project, or open: Import Raycasting-pxt-extension.