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.

probability event

Problem it solves

You want an enemy to have a 25% chance to drop a rare gem whenever it is defeated.

What this block does

Executes a block of code only if a random percentage roll succeeds against the given chance.

The block

Block ID: retro_probability_event

with $chance % chance do block

Parameters

NameTypeDefaultMeaning
chancenumber50Chance percentage between 0 and 100.
handler() => voidCode to run if the percentage roll succeeds.

Example

Retro.probabilityEvent(30, function () {
    Retro.playRetroSound(Retro.Sounds.RareItem)
})

Add the extension

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