From 5cc296e61ffd99605b26e7ca180ca2c9a8935597 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Sun, 21 Aug 2016 07:56:41 +1000 Subject: [PATCH] Added commas to score --- cat.html | 8 ++++++-- todo | 34 +++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/cat.html b/cat.html index a93d4b4..c098692 100644 --- a/cat.html +++ b/cat.html @@ -503,6 +503,10 @@ function drawline(ctx,x1,y1,x2,y2,col,width) { ctx.stroke(); } +function addcommas(num) { + return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); +} + function drawarrow(ctx,x1,y1,x2,y2,col,width, arrowsize) { drawline(ctx, x1, y1, x2, y2, col, width); drawarrowhead(ctx, x1, y1, x2, y2, col, arrowsize); @@ -690,7 +694,7 @@ var game = { this.context.textAlign = "left"; this.context.textBaseline = "top"; this.context.fillStyle = "white"; - this.context.fillText("Score: " + score, 16, 16); + this.context.fillText("Score: " + addcommas(score), 16, 16); switch (thingsmoving()) { case "parade": @@ -722,7 +726,7 @@ var game = { this.context.textAlign = "center"; this.context.textBaseline = "top"; shadowtext(this.context, "GAME OVER", 20, "red", SCREENW / 2, 5); - shadowtext(this.context, "Final Score: " + score, 16, "white", SCREENW / 2, 35); + shadowtext(this.context, "Final Score: " + addcommas(score), 16, "white", SCREENW / 2, 35); } }, diff --git a/todo b/todo index 6abba35..56ea4e3 100644 --- a/todo +++ b/todo @@ -29,18 +29,34 @@ phone fixes as per http://www.html5rocks.com/en/mobile/touch/ https://www.smashingmagazine.com/2012/10/design-your-own-mobile-game/ -bath time, then next level after getting sufficient llamas - need 5 llamas on first level - then 10, then 15, etc. - new levels: - obstacles - larger grid - new object types ? +*put commas in score + +different levels with goals + eat x cheese + get x parades + get x llamas + break x obstacles + get x goats + etc. + later levels have multiple goals + +use the bottom of the screen to show level goals + +title screen -> level select + +certain levels have help screens (ie. lev 1 is initial help) + +remember which level you're up to + +after each level, show cat picture. -put commas in score +sounds: + chomp + catparade (can-can ?) + indy theme - title screen? + (if so, make title text indy themed too) -use the bottom of the screen for something.