Adding feature: curtains.
This commit is contained in:
parent
e65504184f
commit
9f2c38f48f
87
cat.html
87
cat.html
|
@ -593,14 +593,14 @@ function isvalidpath(mypath) {
|
||||||
if (!gcount) {
|
if (!gcount) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if ((thisone.type == "curtain") && (dirtonext == 0)) {
|
} else if (thisone.type == "curtain") {
|
||||||
// upwards from a curtain is okay.
|
// anywhere from a curtain is okay. (direction checked in canextendpath())
|
||||||
} else if ((i == 0) && (thisone.type == "cat") && (nextone.type == "food")) {
|
} else if ((i == 0) && (thisone.type == "cat") && (nextone.type == "food")) {
|
||||||
// first cat -> food is ok
|
// first cat -> food is ok
|
||||||
} else if ((i == 0) && (thisone.type == "cat") && (nextone.type == "toad")) {
|
} else if ((i == 0) && (thisone.type == "cat") && (nextone.type == "toad")) {
|
||||||
// first cat -> toad is ok
|
// first cat -> toad is ok
|
||||||
} else if ((i == 0) && (thisone.type == "cat") && (nextone.type == "curtain") && (dirtonext == 0)) {
|
} else if ((i == 0) && (thisone.type == "cat") && (nextone.type == "curtain")) {
|
||||||
// first cat -> curtain is ok if we're going UP only
|
// first cat -> curtain is ok if we're going UP/DOWN only
|
||||||
} else if ((i == 0) && (thisone.type == "cat") && (nextone.type == "whitecat")) {
|
} else if ((i == 0) && (thisone.type == "cat") && (nextone.type == "whitecat")) {
|
||||||
// first cat -> whitecat is ok
|
// first cat -> whitecat is ok
|
||||||
} else if ((i != 0) && firstcat && (ccount == 0) && (thisone.type == "food") && (nextone.type == "food")) {
|
} else if ((i != 0) && firstcat && (ccount == 0) && (thisone.type == "food") && (nextone.type == "food")) {
|
||||||
|
@ -1861,7 +1861,7 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
|
||||||
this.addlevelgoals("food", 25);
|
this.addlevelgoals("food", 25);
|
||||||
|
|
||||||
this.addlevel(21, false); // oooooooooooo
|
this.addlevel(21, false); // oooooooooooo
|
||||||
this.addlevelallowedthings("cat", "food");
|
this.addlevelallowedthings("curtain");
|
||||||
this.addlevelforcethings("curtain", 2);
|
this.addlevelforcethings("curtain", 2);
|
||||||
this.addlevelgoals("curtain", 2);
|
this.addlevelgoals("curtain", 2);
|
||||||
this.addlevelgoals("cat", 30);
|
this.addlevelgoals("cat", 30);
|
||||||
|
@ -2066,6 +2066,10 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
|
||||||
col = "#00ff00";
|
col = "#00ff00";
|
||||||
texttodraw = "CAT PARADE!";
|
texttodraw = "CAT PARADE!";
|
||||||
break;
|
break;
|
||||||
|
case "climb":
|
||||||
|
col = "#00ff00";
|
||||||
|
texttodraw = "Climb";
|
||||||
|
break;
|
||||||
case "chomp":
|
case "chomp":
|
||||||
col = "#00cc00";
|
col = "#00cc00";
|
||||||
texttodraw = "Chomp!";
|
texttodraw = "Chomp!";
|
||||||
|
@ -5118,7 +5122,7 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
|
||||||
'cat1', 'catfull1', 'catscared1',
|
'cat1', 'catfull1', 'catscared1',
|
||||||
'llama', 'cheese', 'title',
|
'llama', 'cheese', 'title',
|
||||||
'goat', 'lock','catwalkl','catwalkr','goatwalkl','goatwalkr',
|
'goat', 'lock','catwalkl','catwalkr','goatwalkl','goatwalkr',
|
||||||
'starfull','starempty', 'curtain','curtainshred',
|
'starfull','starempty', 'curtain','curtainshred', 'curtainfall',
|
||||||
'door', 'sunlight', 'toad', 'whitecat', // special things
|
'door', 'sunlight', 'toad', 'whitecat', // special things
|
||||||
'brick', // obstacles
|
'brick', // obstacles
|
||||||
'bag', 'bagpop', 'fez', 'pow', 'brickpop', // effects
|
'bag', 'bagpop', 'fez', 'pow', 'brickpop', // effects
|
||||||
|
@ -5274,6 +5278,19 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
|
||||||
curtaindie = true;
|
curtaindie = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// first cat swaps places with last object
|
||||||
|
curpath[0].pushpath(curpath[curpath.length-1].x, curpath[curpath.length-1].y);
|
||||||
|
curpath[0].state = "swapping";
|
||||||
|
curpath[0].counter = 1;
|
||||||
|
// ...then becomes sleepy
|
||||||
|
curpath[0].sleepy = true;
|
||||||
|
|
||||||
|
|
||||||
|
curpath[curpath.length-1].pushpath(curpath[0].x, curpath[0].y);
|
||||||
|
curpath[curpath.length-1].state = "swapping";
|
||||||
|
|
||||||
|
|
||||||
if (curtaindie) {
|
if (curtaindie) {
|
||||||
// if any curtains died, _all_ curtains die
|
// if any curtains died, _all_ curtains die
|
||||||
for (i = 1; i < curpath.length-1; i++) {
|
for (i = 1; i < curpath.length-1; i++) {
|
||||||
|
@ -5281,16 +5298,6 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
|
||||||
curpath[i].losehp();
|
curpath[i].losehp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// move cat up so it'll fall
|
|
||||||
curpath[0].setgridxy(curpath[curpath.length-2].gridx, curpath[curpath.length-2].gridy);
|
|
||||||
} else {
|
|
||||||
// first cat swaps places with last object
|
|
||||||
curpath[0].pushpath(curpath[curpath.length-1].x, curpath[curpath.length-1].y);
|
|
||||||
curpath[0].state = "swapping";
|
|
||||||
curpath[0].counter = 1;
|
|
||||||
|
|
||||||
curpath[curpath.length-1].pushpath(curpath[0].x, curpath[0].y);
|
|
||||||
curpath[curpath.length-1].state = "swapping";
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "slap": // toad drops down.
|
case "slap": // toad drops down.
|
||||||
|
@ -5450,7 +5457,7 @@ function collectprize(bag) {
|
||||||
case "tissues": // all sleepy cats wake up
|
case "tissues": // all sleepy cats wake up
|
||||||
for (i = 0; i < things.length; i++) {
|
for (i = 0; i < things.length; i++) {
|
||||||
if (things[i].type == "cat") {
|
if (things[i].type == "cat") {
|
||||||
things[i].eaten = false;
|
things[i].sleepy = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -5525,6 +5532,7 @@ function getrandomtype() {
|
||||||
if (dodb) console.log("specials are possible");
|
if (dodb) console.log("specials are possible");
|
||||||
thinglist.push({ type: 'special', pct: 5 } );
|
thinglist.push({ type: 'special', pct: 5 } );
|
||||||
}
|
}
|
||||||
|
if (!game.isbanned(curlevel, 'curtain')) thinglist.push({ type: 'curtain', pct: 5 } );
|
||||||
if (!game.isbanned(curlevel, 'goat')) thinglist.push({ type: 'goat', pct: 10 } );
|
if (!game.isbanned(curlevel, 'goat')) thinglist.push({ type: 'goat', pct: 10 } );
|
||||||
if (!game.isbanned(curlevel, 'llama')) thinglist.push({ type: 'llama', pct: 10 } );
|
if (!game.isbanned(curlevel, 'llama')) thinglist.push({ type: 'llama', pct: 10 } );
|
||||||
if (!game.isbanned(curlevel, 'food')) thinglist.push({ type: 'food', pct: 40 } );
|
if (!game.isbanned(curlevel, 'food')) thinglist.push({ type: 'food', pct: 40 } );
|
||||||
|
@ -5749,6 +5757,9 @@ function thing(gridx, gridy, type, text, col) {
|
||||||
if (this.type == "bagpop") {
|
if (this.type == "bagpop") {
|
||||||
this.yspeed = 0 - rndfloat(8);
|
this.yspeed = 0 - rndfloat(8);
|
||||||
this.xspeed = 0 - rndfloat(16) - 1;
|
this.xspeed = 0 - rndfloat(16) - 1;
|
||||||
|
} else if (this.type == "curtainfall") {
|
||||||
|
this.yspeed = 0 - rndfloat(8);
|
||||||
|
this.xspeed = rndfloat(8) - 4;
|
||||||
} else if (this.type == "brickpop") {
|
} else if (this.type == "brickpop") {
|
||||||
this.yspeed = 0 - rndfloat(8);
|
this.yspeed = 0 - rndfloat(8);
|
||||||
this.xspeed = rndfloat(32) - 16;
|
this.xspeed = rndfloat(32) - 16;
|
||||||
|
@ -5769,7 +5780,7 @@ function thing(gridx, gridy, type, text, col) {
|
||||||
|
|
||||||
this.path = [];
|
this.path = [];
|
||||||
this.pathspeed = PARADESPEED;
|
this.pathspeed = PARADESPEED;
|
||||||
this.eaten = false;
|
this.sleepy = false;
|
||||||
|
|
||||||
if (this.type == "text" ) {
|
if (this.type == "text" ) {
|
||||||
this.x = gridx * GRIDSIZE + (GRIDSIZE/2);
|
this.x = gridx * GRIDSIZE + (GRIDSIZE/2);
|
||||||
|
@ -5793,7 +5804,7 @@ function thing(gridx, gridy, type, text, col) {
|
||||||
|
|
||||||
this.issleepy = function() {
|
this.issleepy = function() {
|
||||||
if (this.type == "cat") {
|
if (this.type == "cat") {
|
||||||
if (this.eaten == true) {
|
if (this.sleepy == true) {
|
||||||
return true;
|
return true;
|
||||||
} else if (isadjacenttotype(this, "sunlight")) {
|
} else if (isadjacenttotype(this, "sunlight")) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -6176,7 +6187,7 @@ function thing(gridx, gridy, type, text, col) {
|
||||||
} else {
|
} else {
|
||||||
ctx.fillStyle = "black";
|
ctx.fillStyle = "black";
|
||||||
ctx.fillText(this.name, BOARDX + this.x + 10, BOARDY + this.y + (THINGSIZE/2));
|
ctx.fillText(this.name, BOARDX + this.x + 10, BOARDY + this.y + (THINGSIZE/2));
|
||||||
ctx.fillText(this.eaten ? "FULL" : "", BOARDX + this.x + 10, BOARDY + this.y + (THINGSIZE/2) + 10);
|
ctx.fillText(this.sleepy ? "FULL" : "", BOARDX + this.x + 10, BOARDY + this.y + (THINGSIZE/2) + 10);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -6240,11 +6251,26 @@ function thing(gridx, gridy, type, text, col) {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getstoppedbelowthing = function() {
|
this.getstoppedbelowthing = function() {
|
||||||
var bt;
|
var bt,i;
|
||||||
bt = getgridthing(this.gridx, this.gridy + 1);
|
bt = getgridthing(this.gridx, this.gridy + 1);
|
||||||
if (bt && bt.state != "fall") {
|
if (bt && bt.state != "fall") {
|
||||||
return bt;
|
return bt;
|
||||||
}
|
}
|
||||||
|
// look for things movng to the place below.
|
||||||
|
for (i = 0; i < things.length; i += 1) {
|
||||||
|
if (things[i] != this && things[i].state == "swapping" && things[i].path != undefined) {
|
||||||
|
var n;
|
||||||
|
for (n = 0; n < things[i].path.length; n++) {
|
||||||
|
var gx,gy;
|
||||||
|
gx = Math.floor(things[i].path[n].x / GRIDSIZE);
|
||||||
|
gy = Math.floor(things[i].path[n].y / GRIDSIZE);
|
||||||
|
// get grid coords
|
||||||
|
if (gx == this.gridx && gy == this.gridy + 1) {
|
||||||
|
return things[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6353,7 +6379,7 @@ function thing(gridx, gridy, type, text, col) {
|
||||||
food.startexplode("chomp");
|
food.startexplode("chomp");
|
||||||
|
|
||||||
// mark that we've eaten something
|
// mark that we've eaten something
|
||||||
this.eaten = true;
|
this.sleepy = true;
|
||||||
|
|
||||||
console.log("chomp");
|
console.log("chomp");
|
||||||
}
|
}
|
||||||
|
@ -6363,12 +6389,24 @@ function thing(gridx, gridy, type, text, col) {
|
||||||
if (this.type == "firework") return true;
|
if (this.type == "firework") return true;
|
||||||
if (this.type == "bagpop") return true;
|
if (this.type == "bagpop") return true;
|
||||||
if (this.type == "brickpop") return true;
|
if (this.type == "brickpop") return true;
|
||||||
|
if (this.type == "curtainfall") return true;
|
||||||
if (this.state == "explode") return true;
|
if (this.state == "explode") return true;
|
||||||
if (this.state == "shrink") return true;
|
if (this.state == "shrink") return true;
|
||||||
if (this.state == "parade") return true;
|
if (this.state == "parade") return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.shredcurtain = function() {
|
||||||
|
var i,nshards = 7;
|
||||||
|
for (i = 0; i < nshards; i++) {
|
||||||
|
things.push(new thing(this.gridx, this.gridy, "curtainfall"));
|
||||||
|
}
|
||||||
|
|
||||||
|
this.givepoints();
|
||||||
|
this.addabove();
|
||||||
|
this.kill();
|
||||||
|
}
|
||||||
|
|
||||||
this.breakbrick = function() {
|
this.breakbrick = function() {
|
||||||
var i,nshards = 7;
|
var i,nshards = 7;
|
||||||
for (i = 0; i < nshards; i++) {
|
for (i = 0; i < nshards; i++) {
|
||||||
|
@ -6388,8 +6426,7 @@ function thing(gridx, gridy, type, text, col) {
|
||||||
if (this.type == "brick") {
|
if (this.type == "brick") {
|
||||||
this.breakbrick();
|
this.breakbrick();
|
||||||
} else {
|
} else {
|
||||||
this.addabove();
|
this.shredcurtain();
|
||||||
this.startexplode();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// add a slash from a random x/y to a random x/y
|
// add a slash from a random x/y to a random x/y
|
||||||
|
@ -6475,7 +6512,7 @@ function thing(gridx, gridy, type, text, col) {
|
||||||
|
|
||||||
if (this.type == "firework" && this.delay > 0) {
|
if (this.type == "firework" && this.delay > 0) {
|
||||||
this.delay--;
|
this.delay--;
|
||||||
} else if ((this.type == "bagpop") || (this.type == "brickpop") || (this.type == "firework")) {
|
} else if ((this.type == "bagpop") || (this.type == "brickpop") || (this.type == "firework") || (this.type == "curtainfall")) {
|
||||||
game.dirty = true; // need to redraw
|
game.dirty = true; // need to redraw
|
||||||
|
|
||||||
// regular gravity
|
// regular gravity
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 351 B |
49
todo
49
todo
|
@ -1,10 +1,5 @@
|
||||||
http://www.w3schools.com/games/tryit.asp?filename=trygame_default_gravity
|
http://www.w3schools.com/games/tryit.asp?filename=trygame_default_gravity
|
||||||
|
|
||||||
*don't draw fireworks on gameover screen.
|
|
||||||
*randomised goat on title screen.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
phone fixes as per http://www.html5rocks.com/en/mobile/touch/
|
phone fixes as per http://www.html5rocks.com/en/mobile/touch/
|
||||||
|
|
||||||
----------------------------
|
----------------------------
|
||||||
|
@ -15,6 +10,8 @@ https://www.smashingmagazine.com/2012/10/design-your-own-mobile-game/
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
|
||||||
|
*things shouldn't all if something is swapping to underneath them!.
|
||||||
|
|
||||||
new door fell down on top of new goat!!
|
new door fell down on top of new goat!!
|
||||||
(or the other way around ??)
|
(or the other way around ??)
|
||||||
check code for doors falling when off the top of the screen.
|
check code for doors falling when off the top of the screen.
|
||||||
|
@ -23,26 +20,50 @@ new door fell down on top of new goat!!
|
||||||
change 'thing' to have a constructor!!
|
change 'thing' to have a constructor!!
|
||||||
then remove dupe hp code
|
then remove dupe hp code
|
||||||
|
|
||||||
curtain
|
|
||||||
*can only drag a cat UP onto a curtain.
|
|
||||||
*cat UP onto curtain = lose 1 hp
|
|
||||||
*clime multi curtain
|
|
||||||
*if ANY curtains are shredded, all are.
|
|
||||||
*shred all curtains climed
|
|
||||||
|
|
||||||
normal chance for curtain (5% ???)
|
|
||||||
curtain shred explosion
|
curtain
|
||||||
|
*normal chance for curtain (5%)
|
||||||
|
*allowing climbing over to curtain from any dir
|
||||||
|
*becomesleepy after climb
|
||||||
|
*curtain shred explosion
|
||||||
help (lev21)
|
help (lev21)
|
||||||
|
cats can climb across curtains in any direction.
|
||||||
|
|
||||||
|
this damages the curtains, and swaps places with
|
||||||
|
something else.
|
||||||
|
|
||||||
|
|
||||||
|
------->
|
||||||
|
ca CU CU ch
|
||||||
|
|
||||||
|
to
|
||||||
|
|
||||||
|
------------|
|
||||||
|
| V
|
||||||
|
ch CU- CU- ca
|
||||||
|
^ |
|
||||||
|
-------------
|
||||||
|
|
||||||
|
After being climbed twice, curtains are shredded.
|
||||||
|
|
||||||
|
ch ca
|
||||||
|
|
||||||
|
CU- ----> POP ----> ca
|
||||||
|
|
||||||
|
ca ch ch
|
||||||
|
|
||||||
|
|
||||||
remaining levels.
|
remaining levels.
|
||||||
*19/20 - more with brick patterns
|
*19/20 - more with brick patterns
|
||||||
22/23/24 - curtains
|
22/23/24 - curtains (shred 2, 4, 6)
|
||||||
24/25/26 - boxes
|
24/25/26 - boxes
|
||||||
26/27/28 - cat toys
|
26/27/28 - cat toys
|
||||||
29/30 - ???
|
29/30 - ???
|
||||||
|
|
||||||
goal: x parades of y length!!!
|
goal: x parades of y length!!!
|
||||||
|
|
||||||
|
random levels.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue