Constructor
# new Medal(id, name, descriptionopt, iconopt, srcopt)
Create an medal object and adds it to the list of medals
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id |
Number | The unique identifier of the medal | ||
name |
String | Name of the medal | ||
description |
String |
<optional> |
Description of the medal | |
icon |
String |
<optional> |
'🏆' | Icon for the medal |
src |
String |
<optional> |
Image location for the medal |
- Source:
Example
// create a medal
const medal_example = new Medal(0, 'Example Medal', 'More info about the medal goes here.', '🎖️');
// unlock the medal
medal_example.unlock();
Methods
# render(hidePercentopt)
Render a medal
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
hidePercent |
Number |
<optional> |
0 | How much to slide the medal off screen |
- Source:
# renderIcon(x, y, sizeopt)
Render the icon for a medal
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
x |
Number | Screen space X position | ||
y |
Number | Screen space Y position | ||
size |
Number |
<optional> |
medalDisplayIconSize | Screen space size |
- Source:
# unlock()
Unlocks a medal if not already unlocked
- Source: