Jump to content

Inheritance Question


charlie_says
 Share

Recommended Posts

So, whilst I can see my inherited functions, I don't seem to be able to access variables set in the parent constructor:

BaseSprite = function (game){    // create empty sprite    Phaser.Sprite.call(this, game);   this.arbitraryValue = "hello";};BaseSprite.prototype = Object.create(Phaser.Sprite.prototype);BaseSprite.prototype.constructor = BaseSprite;BaseSprite.prototype.update = function() {   };Monster = function (game){    console.log(this.arbitraryValue);; returns};Monster.prototype = Object.create(BaseSprite.prototype);Monster.prototype.constructor = Monster;Monster.prototype.update = function() {   };
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...