ccquiroga Posted July 5, 2015 Share Posted July 5, 2015 Hello everyone, i'm making my first Phaser Game but when i run it, it shows me the followin error: Uncaught ReferenceError: p2 is not defined phaser.js:77528 im newbe developing in html5 and Phaser. so please, if anyone knows how to solve it i will apreciate it so much Sorry if my english is not good hehe Link to comment Share on other sites More sharing options...
starrynight Posted July 7, 2015 Share Posted July 7, 2015 I guess you're using requireJS? I'm getting the exact same error, but only when starting a new project from the official Phaser RequireJS template (https://github.com/photonstorm/phaser/tree/master/resources/Project%20Templates/RequireJS). I was following this tutorial: http://www.gamefromscratch.com/post/2014/11/20/Phaser-with-RequireJS-and-Bower.aspx but nothing loaded in the browser, and I saw the same error ( Uncaught ReferenceError: p2 is not defined phaser.js:77528) in Chrome dev tools. Unfortunately, I suppose this is a well known issue with the requirejs-based template, see the discussion here: http://www.html5gamedevs.com/topic/4163-getting-p2-is-not-defined Though there is a fix/workaround mentioned in that thread, it's far too convoluted for a n00b like myself. I've been successfully playing with phaser.js in other projects where I didn't use requireJS (e.g. I finished the tutorial at http://phaser.io/tutorials/making-your-first-phaser-game), so I guess the problem arises from requirejs. In summary, I think the RequireJS Phaser template is broken. It should just work out-of-the-box and shouldn't need workarounds :-/ I'm just going to continue with the vanilla project template for now, and not dabble with requirejs for my phaser projects. Anyone else here have a working requireJS Phaser template? Link to comment Share on other sites More sharing options...
Recommended Posts