furqan.2712 Posted March 25, 2014 Share Posted March 25, 2014 Hi all, I write my first code but having problem in loading image.... here is the javascript to load image var game = new Phaser.Game(800, 600, Phaser.AUTO, 'screen', {preload: preload, create: create, update: update}); function preload() { game.load.image('back', "back.png"); } function create() { game.add.sprite(0, 0, "back");} function update() { } Link to comment Share on other sites More sharing options...
rich Posted March 25, 2014 Share Posted March 25, 2014 The problem isn't the code, it's that you've just dragged your html file into your browser and expected it to work. I would strongly recommend you go through our Getting Started Guide, it covers this and how to get a working environment set-up. Natman 1 Link to comment Share on other sites More sharing options...
Rocco Posted March 26, 2014 Share Posted March 26, 2014 Maybe the easiest and convenient way to start is to use brackets -> http://brackets.io/There you have an inbuild testing instance with chrome, just by clicking the preview button. Link to comment Share on other sites More sharing options...
drhayes Posted March 27, 2014 Share Posted March 27, 2014 Yup! Chrome considers anything outside your current directory to be cross-domain when using "file://" URLs. Rich is right; you should follow the Getting Started guide. If you don't want to download and run Apache you should try Node's https://github.com/nodeapps/http-server project. It requires you to have a working Node installation, but I find it a lighter-weight alternative to using Apache and a better/faster alternative to Python's SimpleHTTPServer. Link to comment Share on other sites More sharing options...
Rocco Posted March 27, 2014 Share Posted March 27, 2014 hmm, well when you use brackets you don't have to deal with all that stuff,...just type in your code and press preview and you are fine. Link to comment Share on other sites More sharing options...
adamyall Posted March 27, 2014 Share Posted March 27, 2014 If you don't want to switch to Brackets for local hosting (I use Brackets for coding, but not for hosting) I suggest using Prepros. It's mainly for precompiling a lot of different scripts, but it has a POWERFUL live update feature. You can actually point your browser, your phone, and an iPad to the same page, make a change, save, and watch them all refresh in real time. Link to comment Share on other sites More sharing options...
drhayes Posted March 28, 2014 Share Posted March 28, 2014 Oh, that looks neat. I'm definitely checking it out. Thanks! I'm a browserify nut so I'm using beefy to concat my code while working on it. Probably just going to bash up some scripts for deployment and stuff once I get to a point where I can show my game to people. Link to comment Share on other sites More sharing options...
Recommended Posts