Jump to content

Recommended Posts

I am making a game, everything works except the physics system? Collisions and Gravity are in the code but don’t seem to work.  Using breakpoints, it gets to all the pieces of code but never actually works.  I have tried to frantically make it work (Thats why theres so much physics code in the file).  Can anyone please help me?


This is the code that I think you will need: http://pastebin.com/0Sh8pqVJ

This is all of the code together: http://pastebin.com/CfFuatdt



Link to comment
Share on other sites

game.physics.arcade.collide(this.player, ...)

this.player isn't a Phaser.Sprite - it's a JavaScript object you've created. So Phaser has no idea how to collide it, because it doesn't have any of the properties the physics system expects. You should be colliding this.playerImage - as that is the sprite with the physics body.


Also in your update function you call gameDraw.


But gameDraw adds 5 new sprites into the game every single time it is called. Which on a desktop will be 60 times every second. Leave your game running for just half a minute and you'll have 9000 sprites on screen. Is that intended?

Link to comment
Share on other sites


  • Recently Browsing   0 members

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