Initial loading screen now works. (but is ugly)
This commit is contained in:
parent
b4e6114875
commit
bd6b39a085
38
cat.html
38
cat.html
|
@ -258,8 +258,11 @@ var llamatext = "llama";
|
|||
var image = new Array();
|
||||
var winimg = null;
|
||||
|
||||
|
||||
var nfonts = 0;
|
||||
var nimages = 0;
|
||||
var maximages = 0;
|
||||
var maxfonts = 0;
|
||||
|
||||
function loadimage(name, filename) {
|
||||
image[name] = new Image();
|
||||
|
@ -576,18 +579,6 @@ function getdir(thing1, thing2) {
|
|||
}
|
||||
|
||||
function startGame() {
|
||||
var i;
|
||||
|
||||
imagenames = ['cat', 'catfull', 'catscared', 'llama', 'cheese', 'title',
|
||||
'goat','door','sunlight','lock','catwalkl','catwalkr','starfull','starempty' ];
|
||||
|
||||
|
||||
nimages = 0;
|
||||
maximages = 0;
|
||||
for (i in imagenames) {
|
||||
maximages++;
|
||||
loadimage(imagenames[i], 'images/' + imagenames[i] + '.png');
|
||||
}
|
||||
|
||||
game.init();
|
||||
game.initlevels();
|
||||
|
@ -987,12 +978,14 @@ var game = {
|
|||
},
|
||||
|
||||
incloadprogress : function() {
|
||||
setTimeout(function () {
|
||||
nimages++;
|
||||
console.log(nimages + " / " + maximages + " images loaded.");
|
||||
}, (rnd(3)+1) * 1000);
|
||||
},
|
||||
|
||||
drawloader : function() {
|
||||
var bgcol = "#00ccff";
|
||||
var bgcol = "#008c8c";
|
||||
var pct = nimages / maximages;
|
||||
|
||||
ctx.fillStyle = bgcol;
|
||||
|
@ -3381,9 +3374,14 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
|
|||
},
|
||||
|
||||
setstate : function(newstate) {
|
||||
|
||||
|
||||
console.log("setstate() = " + newstate);
|
||||
|
||||
if (newstate != this.state) {
|
||||
this.dirty = true;
|
||||
}
|
||||
|
||||
if (newstate == "help") {
|
||||
// decide which word to use
|
||||
if (onein(2)) {
|
||||
|
@ -3438,11 +3436,21 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
|
|||
// start fade in
|
||||
wipe.start("", "in", 15);
|
||||
} else if (newstate == "loader") {
|
||||
// start loading images
|
||||
var i;
|
||||
|
||||
imagenames = ['cat', 'catfull', 'catscared', 'llama', 'cheese', 'title',
|
||||
'goat','door','sunlight','lock','catwalkl','catwalkr','starfull','starempty' ];
|
||||
|
||||
nfonts = 0;
|
||||
maxfonts = 0;
|
||||
nimages = 0;
|
||||
maximages = 0;
|
||||
for (i in imagenames) {
|
||||
maximages++;
|
||||
loadimage(imagenames[i], 'images/' + imagenames[i] + '.png');
|
||||
}
|
||||
}
|
||||
|
||||
console.log("setstate() = " + newstate);
|
||||
|
||||
this.state = newstate;
|
||||
},
|
||||
|
|
7
todo
7
todo
|
@ -8,15 +8,10 @@ https://www.smashingmagazine.com/2012/10/design-your-own-mobile-game/
|
|||
|
||||
----------
|
||||
|
||||
*game is correct size on phone but HUGE in browsers!
|
||||
* scale to highest dimension.
|
||||
|
||||
loading screen
|
||||
|
||||
|
||||
white outline ?
|
||||
|
||||
foot - cats push it, clear the horiz. line.
|
||||
foot/human - cats push it, clear the horiz. line.
|
||||
|
||||
powerups
|
||||
get by... doors ?
|
||||
|
|
Loading…
Reference in New Issue