olladitan Posted July 18, 2013 Share Posted July 18, 2013 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 More sharing options...
rich Posted July 18, 2013 Share Posted July 18, 2013 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 More sharing options...
olladitan Posted July 18, 2013 Author Share Posted July 18, 2013 I have this line in default.html: <script type="text/javascript" src="src/Phaser/phaser.js"> Link to comment Share on other sites More sharing options...
rich Posted July 18, 2013 Share Posted July 18, 2013 Upload it somewhere so I can see (the whole project, not just the 1 file). Dropbox, free web host, whatever. You can PM me the link if you'd rather not share it in public. Link to comment Share on other sites More sharing options...
olladitan Posted July 18, 2013 Author Share Posted July 18, 2013 ok. here is the link. I am using microsoft visual studio 2012 https://dl.dropboxusercontent.com/u/57247920/PhaserProject1.zip Link to comment Share on other sites More sharing options...
olladitan Posted July 19, 2013 Author Share Posted July 19, 2013 Have you found out what is wrong yet? Link to comment Share on other sites More sharing options...
rich Posted July 19, 2013 Share Posted July 19, 2013 Yes, you're linking to the wrong phaser.js file You need to link to the one in the build directory (or the one in the root of the Tests folder). Link to comment Share on other sites More sharing options...
olladitan Posted July 19, 2013 Author Share Posted July 19, 2013 Hi. The project works now in the web browser. Thanks. when i build the solution visual studio says: Error 1 Could not find symbol 'Phaser'. ...\PhaserProject1\app.ts 3 22 app.ts is there a way to make this error go away? Link to comment Share on other sites More sharing options...
Recommended Posts