Jump to content

uncaught Type Error


olladitan
 Share

Recommended Posts

hello with this code I am getting an Uncuaght TypeError: undefined is not valid at appt.ts line 3. Thanks for the help.

appt.ts:

(function () {    var myGame = new Phaser.Game(this, 'game', 800, 600, null, create, update);Uncaught TypeError: undefined is not a function    var circle: Phaser.GeomSprite;    var floor: Phaser.GeomSprite;    function create() {        circle = myGame.createGeomSprite(200, 0);        circle.createCircle(64);        circle.acceleration.y = 100;        circle.elasticity = 0.8;        //  A simple floor        floor = myGame.createGeomSprite(0, 550);        floor.createRectangle(800, 50);        floor.immovable = true;    }    function update() {        myGame.collide(circle, floor);    }})();

default.htm:

<!DOCTYPE html><html lang="en"><head>    <meta charset="utf-8" />    <title>TypeScript HTML App</title>    <link rel="stylesheet" href="app.css" type="text/css" />    <script type="text/javascript" src="src/Phaser/phaser.js"></script>    <script src="app.js"></script></head><body>    <h1>TypeScript HTML App</h1>    <div id="content"></div></body></html>

 

Link to comment
Share on other sites

I'm not sure how you've got your project set-up, but you almost certainly need to add <script> tags into your html for phaser itself (as I doubt it's being compiled into app.js). Have a look at the index page in the test suite for an example.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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