Beep8 logo

Passcodes Documentation

Passcodes Documentation Source Code

Beep8 includes a simple passcode system to let players unlock levels or features. Passcodes are short strings that can be easily shared and entered by players. They use a key, and then automatically generate different codes for each level or feature. There’s also a built-in system for entering passcodes in-game, so you don’t have to build your own UI. You can see them in action in Crate Crew on BeepMini.

Passcodes Methods

beep8.Passcodes.checkCode(id, code)

Function to check if a given code is valid for a given id.

Parameters

  • id (string): The id to check the code for.
  • code (string): The code to check.

Returns

  • (boolean): True if the code is valid, false otherwise.

beep8.Passcodes.getCode(id)

Function to generate a passcode for a given id. This is intended for level passcodes.

Parameters

  • id (string): The id to generate a code for.

Returns

  • (string): The generated code.

beep8.Passcodes.getId(code)

Function to work out the id from the code.

Parameters

  • code (string): The code to get the id for.

Returns

  • (int): The id for the code.

beep8.Passcodes.input() async

Display a dialog to accept a passcode. This is automatically centered on the screen.

The level id of the specified passcode is returned as an integer.

This can be coloured with the standard beep8.color function.

Returns

  • (number|null): The level id of the passcode.

More Beep8 Docs

Actors Documentation

App Intro Documentation

Async Documentation

Cart API

Core Functions

ECS (Entity Component System) Documentation

Game Math Documentation

Game State

Input Documentation

Inventory API

Joystick Documentation

Menu Documentation

Music Documentation

Particle System Documentation

Passcodes Documentation

Public API

Random Numbers Documentation

SFX Documentation

Scene Documentation

Text Renderer

Textmode

Tilemap Documentation

Utilities Documentation