MakeCode Games!

A fan-made community library of MakeCode Arcade games. Visit MakeCode Arcade to make a game!

← Back to extensions

Retro FX

Add juicy 8-bit sound synthesizers, screen shakes, particle explosions, camera effects, and retro text displays to your games.

on button held

Problem it solves

You want the player to hold the A button for 1 second to charge a heavy attack or open a stubborn door.

What this block does

Detects when a controller button is held down continuously for a specified duration before executing a handler.

The block

Block ID: retro_button_hold

on button $button held $time ms block

Parameters

NameTypeDefaultMeaning
buttoncontroller.Buttoncontroller.AThe controller button to monitor.
timenumber500Hold threshold in milliseconds before triggering.
handler() => voidAction to run once the button has been held long enough.

Example

Retro.onButtonHeld(controller.A, 600, function () {
    Retro.playRetroSound(Retro.Sounds.PowerCharged)
})

Add the extension

Add github:CrzLe0723/RetroFx to your project, or open: Import RetroFx.