title: Uncaught TypeError: Cannot read property 'set' of undefined
body: <p>I've made a constructor (and put it above preload function) like this </p>
  
  <pre><code>character = function(CharX,CharY,CharSpeed){
  this.x = CharX ;
  this.y =  CharY;
  this.speed = CharSpeed;
  this.AddSpriteSheet = function (SprX,SprY,key) {
  this.character = game.add.sprite(SprX,SprY,key);}
  };
  </code></pre>
  
  <p>Later in create function I added </p>
  
  <pre><code>var Char1 = new character(game.world.width*0.5,game.world.height*0.5,5);
  Char1.AddSpriteSheet(game.world.width*0.5,game.world.height*0.5,'character');
  Char1.anchor.set(50,50);
  </code></pre>
  
  <p>Console reads </p>
  
  <blockquote>
    <p>"Uncaught TypeError: Cannot read property 'set' of undefined"</p>
  </blockquote>
  
  <p>What have i done wrong?</p>
  
  <p>Edit : Make error more visible</p>