dsoodak Posted April 11, 2016 Share Posted April 11, 2016 Windows 10, chrome and firefox, running on local WAMP server from example http://phaser.io/examples/v2/sprites/add-an-image <script type="text/javascript"> var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create }); function preload() { game.load.image('pic', 'assets/pics/acryl_bladerunner.png'); } function create(){ var image = game.add.sprite(100, 100, 'pic');//displays image with black background //var image = game.add.image(100, 100, 'pic');//just black background (this version used in example code) } </script> Link to comment Share on other sites More sharing options...
rich Posted April 11, 2016 Share Posted April 11, 2016 Works fine for me: http://phaser.io/sandbox/edit/vRAeLYsF What version of Phaser are you using? Link to comment Share on other sites More sharing options...
dsoodak Posted April 12, 2016 Author Share Posted April 12, 2016 Phaser 2.4.6 Your code works on the on-line engine, but not when I run it on my local machine. As in my own example, changing "var sprite = game.add.image(0, 0, 'phaser');" to "var sprite = game.add.sprite(0, 0, 'phaser');" makes it work Link to comment Share on other sites More sharing options...
dsoodak Posted April 12, 2016 Author Share Posted April 12, 2016 It looks like I'm just not very familiar with which features are included in which build. included "phaser.js" instead of "phaser.min.js" and it worked fine. Link to comment Share on other sites More sharing options...
Tom Atom Posted April 12, 2016 Share Posted April 12, 2016 Hi, check this post: I had problem with Firefox when running game locally (or form local server). If Phaser can not find image then it displays small green square. If you get just black (no picture, no green square), then something is wrong and it may be the issue in linked post. Link to comment Share on other sites More sharing options...
rich Posted April 12, 2016 Share Posted April 12, 2016 11 hours ago, dsoodak said: It looks like I'm just not very familiar with which features are included in which build. included "phaser.js" instead of "phaser.min.js" and it worked fine. I assure you this isn't the problem. Image and Sprite are both available in all builds. Internally they are next to identical as well. There's no way one would render and the other doesn't in such a simple piece of code. Something else is going on, almost certainly local to your browser / set-up. Cache issue, image load issue, web server issue, etc. But it's not the code itself I'm afraid, that's a red herring in this instance. Link to comment Share on other sites More sharing options...
Recommended Posts