Jump to content

game.add.sprite() works, but game.add.image() does not


Recommended Posts

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)


Link to comment
Share on other sites

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...