js error received when using drawImage() in canvas
Below, I create a constructor for 'Player' object, and then add a method 'draw', by using prototype.
In Player.draw(), I use drawImage, to well... draw an image. I keep receiving this error...
The type of an object is incompatible with the expected type of the parameter associated to the object.
function Player(imgsrc, x, y, w, h) {
var that = this;
that.image = new Image();
that.image.src = imgsrc; // set image for player
//alert(that.image.src);
that.X = x;
that.Y = y;
that.width = w;
that.height = h;
}
Player.prototype = {
draw : function(context) {
context.drawImage(this.image, 0, 0); // Problem is here
}
}
Thank you in advance,
snowcap






Cartoon Clouds
Mountains
Sunrise
Clouds
Green Clouds
None

















Help