*lev18: diff colour cats which only match themselves
This commit is contained in:
parent
facceb304f
commit
ce58f29754
157
cat.html
157
cat.html
|
@ -408,7 +408,7 @@ function pathcomplete() {
|
|||
if (curpath.length >= PARADELENGTH) {
|
||||
var lcount = 0,gcount = 0;
|
||||
var i;
|
||||
// includes <= 1 llama?
|
||||
// includes <= 1 llama or has a goat?
|
||||
for (i = 1; i < curpath.length; i++) {
|
||||
if (curpath[i].type == "llama") {
|
||||
lcount++;
|
||||
|
@ -498,6 +498,7 @@ function isvalidpath(mypath) {
|
|||
var gcount = 0;
|
||||
var count = 0;
|
||||
var i;
|
||||
var startcol = null;
|
||||
|
||||
for (i = 0; i < mypath.length - 1; i++) {
|
||||
var thisone,nextone,dirtonext;
|
||||
|
@ -509,6 +510,10 @@ function isvalidpath(mypath) {
|
|||
nextone = mypath[i+1];
|
||||
}
|
||||
*/
|
||||
|
||||
if (i == 0) {
|
||||
startcol = thisone.catcol;
|
||||
}
|
||||
nextone = mypath[i+1];
|
||||
|
||||
|
||||
|
@ -529,14 +534,15 @@ function isvalidpath(mypath) {
|
|||
firstcat = true;
|
||||
}
|
||||
|
||||
if ((thisone.type == "cat") && (nextone.type == "cat")) {
|
||||
if ((thisone.type == "cat") && (nextone.type == "cat") && (nextone.catcol == startcol)) {
|
||||
// no parades on level 1
|
||||
if (curlevel == 1) {
|
||||
return false;
|
||||
}
|
||||
// ...but otherwise lines of cats are ok
|
||||
} else if ((thisone.type == "goat") && (nextone.type == "cat" || nextone.type == "llama" || nextone.type == "goat")) {
|
||||
// goat can go to llama or cat
|
||||
// ...but otherwise lines of cats are ok if they're the right colour
|
||||
} else if ((thisone.type == "goat") &&
|
||||
((nextone.type == "cat" && nextone.catcol == startcol) || nextone.type == "llama" || nextone.type == "goat")) {
|
||||
// goat can go to llama or correctly coloured cat
|
||||
// ok
|
||||
} else if ((nextone.type == "door") && (count >= PARADELENGTH) && (fcount == 0) && (count >= 3) &&
|
||||
(thisone.type == "goat" || thisone.type == "cat" || thisone.type == "llama")) {
|
||||
|
@ -562,7 +568,7 @@ function isvalidpath(mypath) {
|
|||
}
|
||||
} else if ((thisone.type == "cat") && nextone.type == "goat") {
|
||||
// cat -> goat is okay
|
||||
} else if ((thisone.type == "llama") && (nextone.type == "cat" || nextone.type == "goat")) {
|
||||
} else if ((thisone.type == "llama") && ((nextone.type == "cat" && nextone.catcol == startcol) || nextone.type == "goat")) {
|
||||
// no parades on level 1
|
||||
if (curlevel == 1) {
|
||||
return false;
|
||||
|
@ -580,8 +586,8 @@ function isvalidpath(mypath) {
|
|||
// first cat -> toad is ok
|
||||
} else if ((i == 0) && (thisone.type == "cat") && (nextone.type == "whitecat")) {
|
||||
// first cat -> whitecat is ok
|
||||
} else if ((i != 0) && firstcat && (thisone.type == "food")) {
|
||||
// not the first one, first one was a cat, this one is food
|
||||
} else if ((i != 0) && firstcat && (thisone.type == "food") && (nextone.type == "food")) {
|
||||
// not the first one, first one was a cat, this one and next are food
|
||||
} else {
|
||||
// not ok
|
||||
valid = false;
|
||||
|
@ -840,7 +846,8 @@ function getmousexy(event) {
|
|||
return [ adjustx, adjusty, x, y ];
|
||||
}
|
||||
|
||||
function isadjacenttotype(what, wanttype, exceptionthing) {
|
||||
//
|
||||
function isadjacenttotype(what, wanttype, exceptionthing, catcol) {
|
||||
var newgridx,newgridy;
|
||||
var i;
|
||||
|
||||
|
@ -851,7 +858,11 @@ function isadjacenttotype(what, wanttype, exceptionthing) {
|
|||
if (isonscreen(newgridx,newgridy)) {
|
||||
adjthing = getgridthing(newgridx, newgridy);
|
||||
if ((adjthing != undefined) && (adjthing.type == wanttype) && (adjthing != exceptionthing)) {
|
||||
if (catcol == undefined) {
|
||||
return true;
|
||||
} else if (adjthing.catcol == what.catcol) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1425,6 +1436,7 @@ var game = {
|
|||
mylevel.gridw = DEF_GRIDW;
|
||||
mylevel.gridh = DEF_GRIDH;
|
||||
mylevel.boardx = (SCREENW - (DEF_GRIDW * DEF_GRIDSIZE))/2;
|
||||
mylevel.catcols = 1;
|
||||
} else {
|
||||
// default to size of previous one
|
||||
mylevel.gridsize = this.levels[lev-1].gridsize;
|
||||
|
@ -1432,6 +1444,8 @@ var game = {
|
|||
mylevel.gridw = this.levels[lev-1].gridw;
|
||||
mylevel.gridh = this.levels[lev-1].gridh;
|
||||
mylevel.boardx = this.levels[lev-1].boardx;
|
||||
// default to # cat colours from previous one
|
||||
mylevel.catcols = this.levels[lev-1].catcols;
|
||||
}
|
||||
|
||||
mylevel.allowedthings = new Array();
|
||||
|
@ -1500,6 +1514,12 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
|
|||
}
|
||||
},
|
||||
|
||||
setlevelcatcols : function (numcols) {
|
||||
var lev;
|
||||
lev = this.levels.length - 1;
|
||||
this.levels[lev].catcols = numcols;
|
||||
},
|
||||
|
||||
// goal1type goal1count goal2type goal2count etc...
|
||||
addlevelgoals : function () {
|
||||
var i,idx,lev;
|
||||
|
@ -1771,11 +1791,16 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
|
|||
);
|
||||
this.addlevelgoals("brick", 4);
|
||||
|
||||
|
||||
this.addlevel(17, false);
|
||||
this.addlevelbricks(0,4, 1,4, 2,4, 3,4, 4,4, 5,4, 6,4, 7,4);
|
||||
this.addlevelgoals("cat", 25);
|
||||
this.addlevelgoals("llama", 6);
|
||||
|
||||
// introduce other coloured cats.
|
||||
this.addlevel(18, true);
|
||||
this.setlevelcatcols(2);
|
||||
this.addlevelgoals("cat", 30);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -3725,11 +3750,11 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
|
|||
shadowtext(ctx, "Suns set after reaching the the bottom of the play area.", HELPTEXTSIZE,helpcol, textxspace, cury);
|
||||
cury += HELPTEXTYSPACE;
|
||||
} else if (curlevel == 12) {
|
||||
cury = this.drawhelpsubtitle(ctx, "White Cats", cury);
|
||||
cury = this.drawhelpsubtitle(ctx, "White Stuffed Cats", cury);
|
||||
|
||||
ctx.textAlign = "left";
|
||||
ctx.textBaseline = "bottom";
|
||||
shadowtext(ctx, "Cats and white cat toys like fighting.", HELPTEXTSIZE,helpcol, textxspace, cury);
|
||||
shadowtext(ctx, "Cats and white stuffed cats like fighting.", HELPTEXTSIZE,helpcol, textxspace, cury);
|
||||
cury += HELPTEXTYSPACE;
|
||||
shadowtext(ctx, "Fights clear out all objects around the white cat.", HELPTEXTSIZE,helpcol, textxspace, cury);
|
||||
cury += HELPTEXTYSPACE;
|
||||
|
@ -4201,6 +4226,85 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
|
|||
ctx.textBaseline = "bottom";
|
||||
shadowtext(ctx, "Toads and white cats can also break bricks.", HELPTEXTSIZE,helpcol, textxspace, cury);
|
||||
cury += HELPTEXTYSPACE;
|
||||
} else if (curlevel == 18) {
|
||||
var tempslashes;
|
||||
cury = this.drawhelpsubtitle(ctx, "Multi-coloured Cats", cury);
|
||||
|
||||
ctx.textAlign = "left";
|
||||
ctx.textBaseline = "bottom";
|
||||
shadowtext(ctx, "Cats can only form parades with cats of the same colour.", HELPTEXTSIZE,helpcol, textxspace, cury);
|
||||
cury += HELPTEXTYSPACE;
|
||||
|
||||
cury += HELPTEXTYSPACE * 1.5;
|
||||
|
||||
// bad example
|
||||
x = imgsize;
|
||||
y = cury;
|
||||
row1y = y;
|
||||
ctx.drawImage(image['cat'], x, y, imgsize, imgsize);
|
||||
linex[0] = x + imgsize/2;
|
||||
liney[0] = y + imgsize/2;
|
||||
x += gridsize;
|
||||
|
||||
ctx.drawImage(image['cat'], x, y, imgsize, imgsize);
|
||||
x += gridsize;
|
||||
|
||||
ctx.drawImage(image['cat1'], x, y, imgsize, imgsize);
|
||||
linex[1] = x + imgsize/2;
|
||||
liney[1] = y + imgsize/2;
|
||||
x += gridsize*2;
|
||||
|
||||
|
||||
drawarrow(ctx, linex[0], liney[0], linex[1], liney[1], PATHLINECOLBAD, LINEWIDTH, PATHARROWSIZE);
|
||||
drawcross(ctx, x+imgsize/8, row1y+imgsize/8, x + imgsize-imgsize/8, row1y + imgsize-imgsize/8, PATHLINECOLBAD, 3);
|
||||
|
||||
y += gridsize;
|
||||
cury = y;
|
||||
|
||||
// good example 1
|
||||
x = imgsize;
|
||||
row2y = y;
|
||||
ctx.drawImage(image['cat'], x, y, imgsize, imgsize);
|
||||
linex[0] = x + imgsize/2;
|
||||
liney[0] = y + imgsize/2;
|
||||
x += gridsize;
|
||||
|
||||
ctx.drawImage(image['cat'], x, y, imgsize, imgsize);
|
||||
x += gridsize;
|
||||
|
||||
ctx.drawImage(image['cat'], x, y, imgsize, imgsize);
|
||||
linex[1] = x + imgsize/2;
|
||||
liney[1] = y + imgsize/2;
|
||||
x += gridsize*2;
|
||||
|
||||
|
||||
drawarrow(ctx, linex[0], liney[0], linex[1], liney[1], PATHLINECOLGOOD, LINEWIDTH, PATHARROWSIZE);
|
||||
drawtick(ctx, x, row2y, x + imgsize, row2y + imgsize, PATHLINECOLGOOD, 3);
|
||||
|
||||
y += gridsize;
|
||||
cury = y;
|
||||
|
||||
// good example 2
|
||||
x = imgsize;
|
||||
row2y = y;
|
||||
ctx.drawImage(image['cat1'], x, y, imgsize, imgsize);
|
||||
linex[0] = x + imgsize/2;
|
||||
liney[0] = y + imgsize/2;
|
||||
x += gridsize;
|
||||
|
||||
ctx.drawImage(image['cat1'], x, y, imgsize, imgsize);
|
||||
x += gridsize;
|
||||
|
||||
ctx.drawImage(image['cat1'], x, y, imgsize, imgsize);
|
||||
linex[1] = x + imgsize/2;
|
||||
liney[1] = y + imgsize/2;
|
||||
x += gridsize*2;
|
||||
|
||||
|
||||
drawarrow(ctx, linex[0], liney[0], linex[1], liney[1], PATHLINECOLGOOD, LINEWIDTH, PATHARROWSIZE);
|
||||
drawtick(ctx, x, row2y, x + imgsize, row2y + imgsize, PATHLINECOLGOOD, 3);
|
||||
|
||||
|
||||
}
|
||||
|
||||
ctx.textAlign = "center";
|
||||
|
@ -4877,7 +4981,9 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
|
|||
// start loading images
|
||||
var i;
|
||||
|
||||
imagenames = ['cat', 'catfull', 'catscared', 'llama', 'cheese', 'title',
|
||||
imagenames = [ 'cat', 'catfull', 'catscared',
|
||||
'cat1', 'catfull1', 'catscared1',
|
||||
'llama', 'cheese', 'title',
|
||||
'goat', 'lock','catwalkl','catwalkr','starfull','starempty',
|
||||
'door', 'sunlight', 'toad', 'whitecat', // special things
|
||||
'brick', // obstacles
|
||||
|
@ -5391,6 +5497,13 @@ function thing(gridx, gridy, type, text, col) {
|
|||
|
||||
this.type = type;
|
||||
|
||||
if (this.type == "cat") {
|
||||
this.catcol = rnd(game.levels[curlevel].catcols);
|
||||
console.log("added cat with col = " + this.catcol + " / " + game.levels[curlevel].catcols);
|
||||
} else {
|
||||
this.catcol = null;
|
||||
}
|
||||
|
||||
if (col == undefined) {
|
||||
switch (this.type) {
|
||||
case "cat":
|
||||
|
@ -5568,16 +5681,16 @@ function thing(gridx, gridy, type, text, col) {
|
|||
if (isonscreen(newx, newy)) {
|
||||
adj = getgridthing(newx, newy);
|
||||
if (adj != undefined) {
|
||||
if (adj.type == "cat") {
|
||||
if ((adj.type == "cat") && (adj.catcol == this.catcol)) {
|
||||
// adjacent cat
|
||||
if (isadjacenttotype(adj, "llama", this) ||
|
||||
isadjacenttotype(adj, "cat", this) ||
|
||||
isadjacenttotype(adj, "cat", this, catcol) ||
|
||||
isadjacenttotype(adj, "goat", this)) {
|
||||
return true;
|
||||
}
|
||||
} else if (adj.type == "llama") {
|
||||
// adjacent llama
|
||||
if (isadjacenttotype(adj, "cat", this) ||
|
||||
if (isadjacenttotype(adj, "cat", this, catcol) ||
|
||||
isadjacenttotype(adj, "goat", this)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -5772,15 +5885,21 @@ function thing(gridx, gridy, type, text, col) {
|
|||
} else {
|
||||
var myimage;
|
||||
if (this.type == "cat") {
|
||||
var imgname;
|
||||
if (this.state == "parade") {
|
||||
myimage = image['cat'];
|
||||
imgname = 'cat';
|
||||
} else if (this.isscared()) {
|
||||
myimage = image['catscared'];
|
||||
imgname = 'catscared';
|
||||
} else if (this.issleepy() == true) {
|
||||
myimage = image['catfull'];
|
||||
imgname = 'catfull';
|
||||
} else {
|
||||
myimage = image['cat'];
|
||||
imgname = 'cat';
|
||||
}
|
||||
if (this.catcol > 0) {
|
||||
// ie. catfull1, catfull2 etc
|
||||
imgname = imgname + this.catcol;
|
||||
}
|
||||
myimage = image[imgname];
|
||||
} else if (this.type == "food") {
|
||||
myimage = image['cheese'];
|
||||
} else {
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
7
todo
7
todo
|
@ -18,11 +18,15 @@ new door fell down on top of new goat!!
|
|||
|
||||
Powerup to break bricks (but only after bricks appear)
|
||||
|
||||
other colour cats
|
||||
diff colour cats which only match themselves
|
||||
*add
|
||||
*only match themself
|
||||
help
|
||||
|
||||
|
||||
--------------
|
||||
|
||||
|
||||
more goals:
|
||||
form x parades of length y
|
||||
|
||||
|
@ -32,7 +36,6 @@ more prizes: ???
|
|||
|
||||
arrow/signpost - cat parades bounce off and take out htings in the path
|
||||
|
||||
diff colour cats which only match themselves
|
||||
|
||||
actual fireworks when you achieve a goal rather than a flash.
|
||||
fireworks later.
|
||||
|
|
Loading…
Reference in New Issue