knockback
Problem it solves
A player touches an enemy and you want them flung backwards and upwards away from danger.
What this block does
Directly sets the sprite's X and Y velocity components to push them away with force.
The block
Block ID: retro_knockback
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| sprite | Sprite | Entity | The sprite to apply knockback velocity to. |
| vx | number | -50 | Horizontal push velocity. |
| vy | number | -30 | Vertical push velocity. |
Example
let hero = sprites.create(img`.`, SpriteKind.Player) Retro.knockback(hero, -80, -40)
Add the extension
Add github:CrzLe0723/RetroFx to your project, or open: Import RetroFx.