Mostrar arboles creados

This commit is contained in:
Nulo 2021-06-30 16:26:31 +00:00
parent 498bff2d95
commit 66361414bb
1 changed files with 11 additions and 0 deletions

View File

@ -7,6 +7,7 @@ const SEED_COOLDOWN = 300
const MAP_MIN = 1000
const MAP_MAX = 5000
const MAP_SIZE = MAP_MAX - MAP_MIN
const TREES_TO_WIN = 70
export type State = {
current: "jugando"
@ -174,5 +175,15 @@ export function draw(juego: Juego<State>, timestamp: number) {
drawJugadorx(juego)
drawSeeds(juego)
juego.ctx.font = `bold 1rem sans-serif`
juego.ctx.fillText('Usá las flechitas para moverte, y espacio para "disparar" semillas.', 100, 100)
const fontSize = '3rem'
juego.ctx.font = `bold ${fontSize} sans-serif`
const treesText = `Arboles: ${juego.state.trees.length}/${TREES_TO_WIN}`
const treesTextMeasure = juego.ctx.measureText(treesText)
juego.ctx.fillText(treesText,
juego.canvas.width - treesTextMeasure.width - 10,
10 + treesTextMeasure.actualBoundingBoxAscent)
}