aboutsummaryrefslogtreecommitdiff
path: root/src/paperflight/static/draw.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/paperflight/static/draw.js')
-rw-r--r--src/paperflight/static/draw.js14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/paperflight/static/draw.js b/src/paperflight/static/draw.js
index 5dd919f..a4d5310 100644
--- a/src/paperflight/static/draw.js
+++ b/src/paperflight/static/draw.js
@@ -14,7 +14,7 @@ function draw() {
ctx.fillStyle = "#222"
ctx.font = "20px Courier"
ctx.fillText(`Level ${currLevelIndex} (${collected}/${currLevel.coinsNeeded}) - ${currLevel.title} - Time ${Math.round(t / fps / 60)}:${Math.round(t / fps) % 60}`, 20, 20)
-
+
if(gameIsOver){
ctx.font = "20px Courier"
ctx.fillStyle = "black"
@@ -94,7 +94,12 @@ function drawCoin() {
}
}
function drawExit(exit) {
- ctx.fillStyle = "green"
+ if(collected >= currLevel.coinsNeeded){
+ ctx.fillStyle = "green"
+ } else {
+ ctx.fillStyle = "red"
+ }
+
ctx.beginPath()
ctx.arc(exit.x, exit.y, 20, 0, Math.PI * 2)
ctx.fill()
@@ -119,4 +124,9 @@ function drawSwitchRect() {
ctx.stroke()
ctx.setLineDash([]);
}
+}
+function drawText(){
+ ctx.fillStyle = this.style
+ ctx.font = this.font
+ ctx.fillText(this.text, this.x, this.y)
} \ No newline at end of file