From b21e08f5b5033f4ce2cc8fef7277bf8f7e6cf4e1 Mon Sep 17 00:00:00 2001 From: Rob Pearce Date: Sat, 27 Aug 2016 17:47:39 +1000 Subject: [PATCH] Star threshold points at top of screen now update properly as you earn points. --- cat.html | 21 ++++++++++++++++----- todo | 43 +++++++++++++++++++++++-------------------- 2 files changed, 39 insertions(+), 25 deletions(-) diff --git a/cat.html b/cat.html index a610b2d..73b10f8 100644 --- a/cat.html +++ b/cat.html @@ -1046,9 +1046,10 @@ var game = { window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || - function( callback ){ + function( callback ) { window.setTimeout(mainloop, 1000 / 60); }; + })(); this.canvas.addEventListener('mousedown', this.handlemousedown, false); this.canvas.addEventListener('mouseup', this.handlemouseup, false); @@ -3431,11 +3432,11 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio); // remove temp third buffer //document.removeChild(document.getElementById("a")); } + + this.dirty = true; }, setstate : function(newstate) { - - console.log("setstate() = " + newstate); if (newstate != this.state) { @@ -3479,7 +3480,7 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio); this.winimgsize = 0.1; // generate starpoint goal banner for top of screen - this.generatestargoalbanner(); + game.generatestargoalbanner(); wipe.start("", "in", 50); } else if (newstate == "levselect") { @@ -4044,6 +4045,10 @@ function thing(gridx, gridy, type, text) { this.givepoints = function() { var points = 0; + + var prestars,poststars; + prestars = game.calcstars(curlevel, score); + if (this.type == "food") { points = FOODPOINTS; game.progress("food", 1); @@ -4070,6 +4075,13 @@ function thing(gridx, gridy, type, text) { // add animation things.push(new thing(this.gridx, this.gridy, "text", "+" + points)); + + poststars = game.calcstars(curlevel, score); + if (poststars != prestars) { + // regenerate star colors at top, if required + game.generatestargoalbanner(); + } + } } @@ -4563,7 +4575,6 @@ function thing(gridx, gridy, type, text) { function mainloop() { var x, height, gap, minHeight, maxHeight, minGap, maxGap; var i; - requestAnimFrame(mainloop); diff --git a/todo b/todo index 606de2e..0543d48 100644 --- a/todo +++ b/todo @@ -6,13 +6,29 @@ phone fixes as per http://www.html5rocks.com/en/mobile/touch/ ---------------------------- https://www.smashingmagazine.com/2012/10/design-your-own-mobile-game/ ----------- -when a parade is going in to a door, they seem to disappear at the wrong place - ... try slowing them down - thing added at top with x = -1 !!!! - // fixed xsnap - // fixed things moving past their intended pathx/y - test again?? + +make top star goals light up again! + + + +multiplier for path length + 3 = nothing + 6 = x2 from now on + 9 = x3 from now on + ...etc + + doors double entire length + + ... then adjust point goal calculation code. + + +turn limit. + ... then get rid of 'form x parades' goal, just have 'clear x cats' + ... then get rid of 'survive x turns' + ticks down on L of board. + + +...then add more levels fix white outline ? @@ -31,25 +47,12 @@ furniture -multiplier for path length - 3 = nothing - 6 = x2 from now on - 9 = x3 from now on - ...etc - - doors double entire length - - ... then adjust point goal calculation code. fireworks when you achieve a goal *flash for now fireworks later. -turn limit. - ... then get rid of 'form x parades' goal, just have 'clear x cats' - ... then get rid of 'survive x turns' - ticks down on L of board. show points for each element along path??