Possible duplicate:
set attribute using javascript super method
I am trying to create a simple game in HTML5 for fun. I have an Entity class, which should be a superclass of the Player class.
function Entity(x, y) { this.x = x; this.y = y; this.tick = function() {
The problem is in this line:
this.parent.tick.call(this);
I get an error message displayed in the chrome chrome console: "Uncaught TypeError: cannot call method" call "from undefined".
I do not understand, and for a long time I tried to find messages of a similar problem. My call to the superclass constructor works fine, but the call to the "superclass" method does not work.
I am very new to creating games, so I have no idea if this is a good setting (calling an overclass tick from a subclass). If there is a better, more typical way of using people, please advise.
Thanks.
user1203585
source share