Passcodes Documentation
BeepMini 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.
b8.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.
b8.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.
b8.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.
b8.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 b8.color function.
Returns
- (number|null): The level id of the passcode.