-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathstats.ts
More file actions
32 lines (31 loc) · 761 Bytes
/
stats.ts
File metadata and controls
32 lines (31 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//% color="#AA278D" icon="\uf205"
namespace stats {
/**
* Toggle stats being on or off.
*/
//% block="turn stats %on"
//% on.shadow="toggleOnOff"
//% weight=100
export function turnStats(on: boolean) {
game.stats = on;
if (!game.stats && control.EventContext.onStats) {
control.EventContext.onStats("");
}
}
/**
* Set the stat text to a string.
*/
//% block="set stat text to %str"
//% weight=90
export function setStat(str: string) {
control.EventContext.onStats(str);
}
/**
* Returns if stats are on or not as a boolean.
*/
//% block="if stats on"
//% weight=80
export function ifStats() {
return game.stats
}
}