onPress
@zylem/game-lib / actions / onPress
Function: onPress()
onPress():
OnPressAction
Defined in: packages/game-lib/src/lib/actions/persistent-actions.ts:78
Detects the rising edge of a boolean signal (press).
Call .check(isPressed) each frame in your onUpdate; .triggered is
true for one frame on press.
Returns
OnPressAction
Example
const press = entity.action(onPress());
entity.onUpdate(({ inputs }) => {
press.check(inputs.p1.buttons.A.pressed);
if (press.triggered) { // do something once on press }
});