Jessicaward25 Posted July 30, 2015 Share Posted July 30, 2015 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/0Sh8pqVJThis is all of the code together: http://pastebin.com/CfFuatdt Thanks. Link to comment Share on other sites More sharing options...
rich Posted July 30, 2015 Share Posted July 30, 2015 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? Jessicaward25 1 Link to comment Share on other sites More sharing options...
Jessicaward25 Posted July 30, 2015 Author Share Posted July 30, 2015 Hi, thanks for the reply! I have tried what you said, changing player to this.playerImage. It still doesn’t work though Also, thanks for pointing that out, I've changed it now Link to comment Share on other sites More sharing options...
Mattward Posted July 31, 2015 Share Posted July 31, 2015 Does anyone know how to fix this? Link to comment Share on other sites More sharing options...
drhayes Posted July 31, 2015 Share Posted July 31, 2015 Same issue with platform1; it's not a Phaser Sprite. Link to comment Share on other sites More sharing options...
Recommended Posts