1 decade ago by KenD
I have a parent class, EntityFriendly, that defines a very simple behavior for any descendant classes. In the parent's update() function, I simply set the x velocity to whatever value is set for this.speed. This parent class also has a bunch of other behavior that gets inherited, but this behavior is the only one that is not working consistently. If I have two entities of the same class, both inheriting from EntityFriendly, both with speed set to -100 in their class, only one of the instances will actually move.
Where
This has really got me stumped. Any clues as to what could be going on here?
update: function() {
this.vel.x = this.speed;
this.parent();
}
Where
this.speed is set to 0 in the parent class, and -100 in the subclass. If I trace out this.speed and this.vel.x in either class, I can clearly see that this.vel.x is not being set in one of the instances.This has really got me stumped. Any clues as to what could be going on here?
