set Sprite floating pixels
Problem it solves
You want a flying bird, floating coin, or hovering drone to stay elevated above the ground in 3D space.
What this block does
Sets the base floating height (Z-offset) in pixels for a sprite, with an optional smooth transition duration.
The block
Block ID: rcRender_setZOffset
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| sprite | Sprite | mySprite | The sprite to elevate. |
| offset | number | 8 | Floating elevation in pixels (positive is up, negative is down). |
| duration | number | 0 | Time in milliseconds to glide to the new height (0 for instant). |
Returns
void — Nothing.
Example
let coin = sprites.create(img`.`, SpriteKind.Food) Render.setZOffset(coin, 8, 0)
Add the extension
Add github:The-Code-Zone/Raycasting-pxt-extension to your project, or open: Import Raycasting-pxt-extension.