Exploring the world of OOP for the first time, encountering a small challenge:
const panel = {
image : imgs[24],
proportion : this.image.height / this.image.width,
height : this.image.height - (scale),
width : height / proportion,
x : center.x - (width / 2),
y : center.y - (height / 2)
}
panel.draw = function(){
g.ctx.drawImage(this.image,
0, 0,
this.image.width, this.image.height,
this.x, this.y,
this.width, this.height)
}
Encountering a typeError
issue when trying to declare this.image.height
. Seeking an explanation for this.
Additionally, looking for a neater way to declare the method within the object to maintain code organization without clutter.