French Nerd Posted September 17, 2016 Share Posted September 17, 2016 Hi everyone ! I beginning Phaser and javascript today, and something wrong was happened. I have this error : main.js:1 Uncaught ReferenceError: phaser is not defined. But I have already import phaser.js (wich contain the Phaser variable) in my index.html, look at my code ! index.html <!DOCTYPE html> <html> <head> <meta charset ="utf-8" /> <title>My first game</title> <script src="js\phaser.js"></script> <style> body{ background: black; } </style> </head> <body> <script src = "js/main.js"></script> </body> </html> main.js var game = new phaser.Game(640,360, Phaser.AUTO); var GameState = { preload : function(){ }, create : function(){ }, update : function(){ }, }; Link to comment Share on other sites More sharing options...
squilibob Posted September 18, 2016 Share Posted September 18, 2016 js\phaser.js should be js/phaser.js Link to comment Share on other sites More sharing options...
DegGa Posted September 18, 2016 Share Posted September 18, 2016 You have just a little mistake, you should write "var game = new Phaser.Game(640,360, Phaser.AUTO); " instead of "var game = new phaser.Game(640,360, Phaser.AUTO); " (the p at the beginning of "phaser" is uppercase). mattstyles 1 Link to comment Share on other sites More sharing options...
douglas Posted September 18, 2016 Share Posted September 18, 2016 we/i are/am writing an other story like the Dude one on phaser http://codepen.io/featuresmega/pen/ALKLEj then there is https://jsfiddle.net/johndo101/y5j8kyby/ have a lot of fun with phaser or right click show source code works fine when the code is not minimised on a phaser game i am still on this thread Link to comment Share on other sites More sharing options...
French Nerd Posted September 19, 2016 Author Share Posted September 19, 2016 thanks DegGa to your answer ! It's such a newbie mistake ^^ but I didn't see it ! Squilibob --> there's no matter with that, both are ok ! Link to comment Share on other sites More sharing options...
Str1ngS Posted September 19, 2016 Share Posted September 19, 2016 5 hours ago, French Nerd said: Squilibob --> there's no matter with that, both are ok ! That behaviour is different per browser, and in order to always be safe it's better to use / Link to comment Share on other sites More sharing options...
Recommended Posts