add flash light source
Problem it solves
Your player is searching an abandoned house with a flashlight that should only reveal what is directly in the direction they are facing.
What this block does
Attaches a directional cone of light to a sprite in the multi-light system, controlling its angle, direction, and beam range.
The block
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| sprite | Sprite | mySprite | The sprite holding the flashlight. |
| direction | number | 0 | The aiming angle in degrees (0 is right, 90 is down, 180 is left, 270 is up). |
| lightRange | number | 32 | How far forward the flashlight beam reaches in pixels. |
| angleRange | number | 30 | How wide the flashlight beam spread is in degrees. |
| bandWidth | number | 5 | The softness and edge width of the light beam. |
Example
let player = sprites.create(img`.`, SpriteKind.Player) multilights.toggleLighting(true) multilights.addFlashLightSource(player, 0, 48, 40, 5)
Add the extension
Add github:felixtsu/pxt-lantern to your project, or open: Import pxt-lantern.