count(n: number, one: string, many: string) → string
A number with its noun, singular for exactly 1 and plural otherwise: count(1, "enemy", "enemies") is "1 enemy", count(3, "life", "lives") is "3 lives".
| arg | type | description |
|---|
| n | number | |
| one | string | |
| many | string | |
theme(style: string?) → any
| arg | type | description |
|---|
| style | string? | |
label(text: string, style: any?) → any
| arg | type | description |
|---|
| text | string | |
| style | any? | |
expandPadding(style: any) → void
"8px 14px"-style padding (one, two or four lengths) as the numeric paddings the UI lays out with
| arg | type | description |
|---|
| style | any | |
box(kind: string, style: any, children: { any }, id: string?, onClick: string?) → any
| arg | type | description |
|---|
| kind | string | |
| style | any | |
| children | { any } | |
| id | string? | |
| onClick | string? | |
button(th: any, id: string, text: string, opts: any?) → any
| arg | type | description |
|---|
| th | any | |
| id | string | |
| text | string | |
| opts | any? | |
money(n: number) → string
| arg | type | description |
|---|
| n | number | |
hud(th: any, s: any) → any
s = { lives, maxLives, gold, wave, waves, phase, nextIn, bonus, canCall, rules, difficulty, hint, compact, goldPulse, livesPulse }
| arg | type | description |
|---|
| th | any | |
| s | any | |
costLabel(th: any, t: any, fs: number) → any
towers = { { def, label, icon, key, role, cost, affordable, hits, detects, blurb } }, selected = def or nil
| arg | type | description |
|---|
| th | any | |
| t | any | |
| fs | number | |
towerButton(th: any, t: any, selected: boolean, size: number, cb: string) → any
| arg | type | description |
|---|
| th | any | |
| t | any | |
| selected | boolean | |
| size | number | |
| cb | string | |
groupTabs(th: any, groups: { any }?, active: string?, compact: boolean, width: number?) → any
a bar of towers along the bottom
the row of group tabs over a build menu (Towers.setGroups): one button per group, `active` lit
| arg | type | description |
|---|
| th | any | |
| groups | { any }? | |
| active | string? | |
| compact | boolean | |
| width | number? | |
barMenu(th: any, towers: { any }, selected: string?, compact: boolean, narrow: boolean?, frameW: number?, rightGap: number?, tabs: any?) → any
| arg | type | description |
|---|
| th | any | |
| towers | { any } | |
| selected | string? | |
| compact | boolean | |
| narrow | boolean? | |
| frameW | number? | |
| rightGap | number? | |
| tabs | any? | |
cardsMenu(th: any, towers: { any }, selected: string?, compact: boolean, top: number?, narrow: boolean?, tabs: any?) → any
a column of cards down the left side, under the HUD, with what each tower is for. `top` is where the
HUD's column ends (the Commander measures it), so a tall lives display never sits behind the cards.
On a phone held upright the cards become the finger-sized button grid along the bottom.
| arg | type | description |
|---|
| th | any | |
| towers | { any } | |
| selected | string? | |
| compact | boolean | |
| top | number? | |
| narrow | boolean? | |
| tabs | any? | |
minimalMenu(th: any, towers: { any }, selected: string?, compact: boolean) → any
a single quiet line of icons with hotkeys, bottom left
| arg | type | description |
|---|
| th | any | |
| towers | { any } | |
| selected | string? | |
| compact | boolean | |
ringMenu(th: any, towers: { any }, x: number, y: number, compact: boolean) → any
a ring of towers around the chosen tile, at screen point (x, y)
| arg | type | description |
|---|
| th | any | |
| towers | { any } | |
| x | number | |
| y | number | |
| compact | boolean | |
towerPanel(th: any, t: any, compact: boolean, narrow: boolean?, frameW: number?, rightGap: number?) → any
t = { id, label, icon, tierName, tier, maxTier, targeting, modes = { { id, label } }, stats = { damage, range, fireRate }, upgradeCost, canUpgrade, affordable, sellValue, allowSell, kills }
| arg | type | description |
|---|
| th | any | |
| t | any | |
| compact | boolean | |
| narrow | boolean? | |
| frameW | number? | |
| rightGap | number? | |
setEndScreen(fn: any?) → void
Draw your own victory and defeat screens instead of the kit's "Play again" screen:
fn(kind: "won" | "lost", info: { wave, kills, leaks }) -> boolean. Return true when you handled it
(drew your own screen, or hold it back because another screen of yours is up); false lets the kit
draw its own. The kit asks again whenever no menusKit screen is open while the game is over, so a
closed end screen comes back. nil goes back to the kit's screen.
endScreen( ) → any
The end-screen hook a game set with setEndScreen, or nil.