From 25c25f1d67ba32caba4dddf0f99aab3d699e8fbc Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Wed, 22 Aug 2018 16:01:12 +0200 Subject: [PATCH] Draw sprite for high score limit --- src/scene.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/scene.js b/src/scene.js index af20526..cc13a3e 100644 --- a/src/scene.js +++ b/src/scene.js @@ -177,6 +177,17 @@ class Scene extends Screen { this.context.lineTo(this.width(), height); this.context.stroke(); + this.context.save(); + this.context.translate(0, height); + + let pattern = this.context.createPattern(Scene.highscore, 'repeat'); + this.context.fillStyle = pattern; + this.context.beginPath(); + this.context.rect(0, 0, this.width(), 32); + this.context.fill(); + + this.context.restore(); + this.context.font = "15px Arial"; this.context.fillStyle = "rgb(255, 255, 255)"; this.context.fillText("High score: " + Math.floor(100 * this.currentMaxHeight), 0, height - 5); @@ -298,3 +309,6 @@ class Scene extends Screen { Scene.background = new Image(); Scene.background.src = "img/background.png"; + +Scene.highscore = new Image(); +Scene.highscore.src = "img/highscore.png";