title: Uncaught TypeError: Object function has no method
body: <p>I'm sure this is very readily solved.  I'm trying to invoke <code>slowbie.tick();</code></p>
  
  <p>Here's the code:</p>
  
  <pre><code> function slowbie(){ //Enemy that slowly moves towards you.
      this.max = 7;
      this.w = 25;
      this.h = 25;
      this.speed = 5;
      this.points = 1;
      this.enemies = [];
      function spawn(){
          if(this.enemies &lt; this.max){
              for (var i = this.enemies.length; i &lt; this.max; i++) {
              this.x = width + Math.floor(Math.random()*20) + this.w;
              this.y = Math.floor(Math.random()*(height-this.h));
              this.speed = Math.floor(Math.random()*(speed-1))+1;
              this.enemies.push(
                  [this.x, this.y, this.w, this.h, this.speed]);
              }
          }
      }
  
      function move(){
          for (var i = 0; i &lt; this.enemies.length; i++) {
              if (this.enemies[i][0] &gt; -this.w) {
              this.enemies[i][0] -= this.enemies[i][4];
          } else{
              this.enemies[i][0] = width;
              this.enemies[i][1] = Math.floor(Math.random()*(height-this.h));
              this.enemies[i][4] = Math.floor(Math.random()*(this.speed-1))+1;
              }
          }
      }
  
      function hit(){
          var remove = false;
          for (var i = 0; i &lt; lasers.length; i++) {
              for (var j = 0; j &lt; this.enemies.length; j++){
                  if (lasers[i][0] &lt;= (this.enemies[j][0] + this.enemies[j][2]) &amp;&amp;
                      lasers[i][0] &gt;= this.enemies[j][0] &amp;&amp;
                      lasers[i][1] &gt;= this.enemies[j][1] &amp;&amp;
                      lasers[i][1] &lt;= (this.enemies[j][1] + this.enemies[j][3])) {
                  remove = true;
                  this.enemies.splice(j, 1);
                  score += this.points;
                  spawn();
              }
              }
              if (remove) {
              lasers.splice(i, 1);
              remove = false;
              }
          }
      }
  
      function draw(){
          for (var i = 0; i &lt; this.enemies.length; i++) {
              ctx.fillStyle = '#f00';
              ctx.fillRect(this.enemies[i][0], this.enemies[i][1], this.w, this.h);
              }
          }
  
      this.tick = function(){
          spawn();
          hit();
          draw();
          move();
          };
  }
  </code></pre>
  
  <p>I don't understand why tick apparently isn't a privileged method...  Please assist!</p>