casarock Posted March 3, 2014 Share Posted March 3, 2014 Hi, I have two objects. A Player-Sprite and a Platform-Sprite in a collection. My Player-Sprite has no y-velocity. The Platform-Sprite at the collection has a velocity of -50 (from bottom to top). If my Player collides with a platform the platform stops moving immediately. But I want the player to move up with the platform. I've tried several properties like immovable=false, mass of 0 etc. How, if possible, could I achieve this? Later I want to have gravity for player sprite. Is this possible? Or do I have to rethink my approach without using physics? Link to comment Share on other sites More sharing options...
Magnifisite Posted March 3, 2014 Share Posted March 3, 2014 Which version of Phaser are you using and could you post your code? Link to comment Share on other sites More sharing options...
casarock Posted March 3, 2014 Author Share Posted March 3, 2014 Hi, here is some of the code: https://gist.github.com/casarock/9334781 EDIT: I am currently using 1.1.5 of Phaser. Link to comment Share on other sites More sharing options...
Zaidar Posted March 4, 2014 Share Posted March 4, 2014 Instead of collide, use overlapthis.game.physics.collide(this.platforms, this.player, this.collideCallback, null, this);just change the function called, the parameters and return value are the same.this.game.physics.overlap(this.platforms, this.player, this.collideCallback, null, this);link to the doc :http://docs.phaser.io/Phaser.Physics.Arcade.html#toc35"Unlike collide the objects are NOT automatically separated or have any physics applied" Link to comment Share on other sites More sharing options...
casarock Posted March 4, 2014 Author Share Posted March 4, 2014 Hi, I want to have the player on top of the platforms, moving upwards with the same speed as a platform. when the player is outside the platform it show have a gravity of about 250. With overlap the detection is not good enough, as the player sometimes is "inside" a platform. Seems like I have to rewrite it and not using velocity/gravity. What did I misunderstood? Link to comment Share on other sites More sharing options...
Recommended Posts