Jump to content

Sprite not rendering well


Zeephaser
 Share

Recommended Posts

Hey guys I'm new to phaser and I'm testing it out with a simple example, I've run into a problem where my sprites are rendered as black boxes it doesn't matter what sprite I load they all come out as boxes. I don't understand what's happening please help me. Here's my code :

var game=new Phaser.Game(900,800,Phaser.AUTO,"gamediv");

var mainstate={

preload:function(){

game.load.image("circle","circle.png");

game.stage.backgroundColor="00feff";

},

create:function(){

game.physics.startSystem(Phaser.Physics.ARCADE);

this.hellosprite=game.add.sprite(20,300,"circle");

game.physics.arcade.enable(this.hellosprite);

this.hellosprite.body.gravity.y=1000;

this.hellosprite.body.collideWorldBounds=true;

this.hellosprite.body.bounce.y=0.6;

this.cursors.game.input.createCursorKeys();

},

update:function(){

this.hellosprite.body.velocity.x+=1

if(this. hellosprite. body. velocity.x>=30) {

this. hellosprite. body. velocity. x=0;

}

}

};

game.state.add("main",mainstate);

game.state.start("main");

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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