valueerror Posted March 15, 2014 Share Posted March 15, 2014 right now THIS is my approach: global:var platformvelocity1=100;create:movingplatformvertical = game.add.sprite(150, game.world.height - 300, 'paddle'); game.physics.p2.enable(movingplatformvertical);movingplatformvertical.body.setCollisionGroup(groundCG);movingplatformvertical.body.collides(playerCG);movingplatformvertical.body.mass=9999;movingplatformvertical.body.data.gravityScale=0;movingplatformvertical.body.data.motionState =1;movingplatformvertical.body.fixedRotation=true;that means.. create plattform, activate physics, setup collisons, make it waay heavier than the player so the player mass wont affect it, make it immune to gravity, set it to dynamic, disable rotation and then in the update loop:if(movingplatformvertical.body.y > 800){ platformvelocity1*=-1;}else if (movingplatformvertical.body.y < 600){platformvelocity1*=-1;}movingplatformvertical.body.velocity.y =platformvelocity1;movingplatformvertical.body.x = 150; //make x staticyou may test it here: http://test.xapient.net/phaser/ALL/ this looks very improvised and i can not get rid of the feeling that there is a MUCH better, easier way for this - so if you have some insight - please feed me your information.. thank you all very much !! Link to comment Share on other sites More sharing options...
rich Posted March 16, 2014 Share Posted March 16, 2014 Whoa, that's a LOT of mass! You should really use a kinematic body for the platform, not dynamic. And probably a material that stops the player sliding off it, something with a low surface velocity. I'll put together an example showing this next week. Link to comment Share on other sites More sharing options...
valueerror Posted March 16, 2014 Author Share Posted March 16, 2014 haha.. yes.. i just wanted to make sure the player is like an ant to a mountain... looking forward to reading your example whenever it's ready.. thx rich.. Link to comment Share on other sites More sharing options...
valueerror Posted September 8, 2014 Author Share Posted September 8, 2014 http://www.html5gamedevs.com/topic/6148-the-moving-jumpthrough-platform-sum-up-thread-help-very-much-appreciated/http://www.html5gamedevs.com/topic/5175-player-not-moving-with-moving-platform/?hl=%2Bmoving+%2Bplatform this threads contan the answer Link to comment Share on other sites More sharing options...
Recommended Posts