title: Uncaught TypeError: Cannot read property 'add' of undefined (Phaser)
body: <p>im sort of new at this website, currently working on this mini RPG phaser game in brackets. Assuming no spelling errors that i can see, every time i go live, i get stuck with this dang error in my main.js, i looked over my main.js and my index.html, cant find the issue, my phaser.js is under js/phaser.js.    </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var RPG = RPG || {};
  
  var game = new Phaser.Game(640, 480, Phaser.CANVAS);
  
  game.state.add("TitleState", new RPG.TitleState());
  game.state.start("TitleState");</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
      &lt;head&gt;
          &lt;meta charset="utf-8" /&gt;
          &lt;meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" /&gt;
          &lt;title&gt;KawaiiRPG&lt;/title&gt;
      &lt;/head&gt;
      
      &lt;style&gt;
          body {
              padding: 0px;
              margin: 0px;
              background-color: black;
          }
      &lt;/style&gt;
  
      
      &lt;body&gt;
      
         &lt;script src="js/phaser.js"&gt;&lt;/script&gt;
          
          &lt;script src="js/main.js"&gt;&lt;/script&gt;
          
      &lt;/body&gt;
  
  
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://i.stack.imgur.com/G21YH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G21YH.png" alt="screen shot of error"></a></p>