Constructor#
new Medal(id, name, descriptionopt, iconopt, srcopt)#
Create a 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.', '🎖️'); // initialize medals medalsInit('Example Game'); // unlock the medal medal_example.unlock();
Members#
description#
PropertiesType | Description |
---|---|
String | Description of the medal |
- Source
icon#
PropertiesType | Description |
---|---|
String | Icon for the medal |
- Source
id#
PropertiesType | Description |
---|---|
Number | The unique identifier of the medal |
- Source
name#
PropertiesType | Description |
---|---|
String | Name of the medal |
- Source
unlocked#
PropertiesType | Description |
---|---|
Boolean | Is the medal unlocked? |
- Source
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(pos, sizeopt)#
Render the icon for a medal
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
pos | Vector2 | Screen space position | ||
size | Number | <optional> | medalDisplayIconSize | Screen space size |
- Source
unlock()#
Unlocks a medal if not already unlocked
- Source