I'm digging OOP for the first time but I've got a little problem:
var panel = {
img : imgs[24],
prop : this.img.height / this.img.width,
h : this.img.height - (scale),
w : h/prop,
x : center.x - (w / 2),
y : center.y - (h / 2)
}
panel.draw = function(){
g.ctx.drawImage(this.img,
0, 0,
this.img.width, this.img.height,
this.x, this.y,
this.w, this.h)
}
But it looks like declaring this.img.height results in typeError. Can someone explain why?
Also, how can I declare the method inside the object declaration? Nothing special about it: I just don't want my code to look too messy.
thisis not the object you are look^H^H^H^H trying to refer to