bugfix: pamela would hang if the norbert image was not fully loaded
This commit is contained in:
parent
eea0514f13
commit
54c7f36f60
|
@ -148,6 +148,9 @@ jQuery.extend(NorbertNode.prototype, Node.prototype);
|
||||||
function NorbertNode() {
|
function NorbertNode() {
|
||||||
this.norbert = new Image();
|
this.norbert = new Image();
|
||||||
this.norbert.src = "img/norbert-8bit.png";
|
this.norbert.src = "img/norbert-8bit.png";
|
||||||
|
self = this;
|
||||||
|
this.norbertLoaded = false;
|
||||||
|
this.norbert.onload=function() { self.norbertLoaded = true; }
|
||||||
this.position = new Vector(0, 0, 0);
|
this.position = new Vector(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,6 +161,7 @@ NorbertNode.prototype.draw = function() {
|
||||||
var y = Math.floor(this.projection.y - (50 / s));
|
var y = Math.floor(this.projection.y - (50 / s));
|
||||||
//var x = Math.floor(this.projection.x - (192 / s));
|
//var x = Math.floor(this.projection.x - (192 / s));
|
||||||
//var y = Math.floor(this.projection.y - (180 / s));
|
//var y = Math.floor(this.projection.y - (180 / s));
|
||||||
|
if (this.norbertLoaded)
|
||||||
context.drawImage(this.norbert, x, y);
|
context.drawImage(this.norbert, x, y);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user