Sprite jump
Problem it solves
You want to make a platforming jump with custom vertical launch velocity and gravity.
What this block does
Applies vertical velocity and downward acceleration to make a sprite jump. Only works if the sprite is currently standing at its resting elevation.
The block
Block ID: rcRender_jump
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| sprite | Sprite | mySprite | The sprite to jump. |
| v | number | 60 | Initial vertical upward speed in pixels per second. |
| a | number | -250 | Vertical acceleration / gravity in pixels per second squared. |
Returns
void — Nothing.
Example
let mySprite = sprites.create(img`.`, SpriteKind.Player) Render.jump(mySprite, 60, -250)
Add the extension
Add github:The-Code-Zone/Raycasting-pxt-extension to your project, or open: Import Raycasting-pxt-extension.