Moving platforms

Hey,

I have searched the forums for a while but did not find a working solution yet.
The player should jump on a moving platform and stay there until he jumps or moves again. But the problem is that he does not stick to it and falls down.

There are a few suggestions on the forum for example using an enterframe event with transition.to to hold the player in place but this does not work in my situation… and it causes some physics problems.

Are there any more suggestions for my problem? I aready asked joakim krassman on this topic because he seems to have found a solution… but he is not active anymore and can not provide me with his code.

Your help is appreciated!

Max / CineTek

P.S.: I am using the physics engine to make my player jump. The moving platform is a “dynamic” object. [import]uid: 138330 topic_id: 36415 reply_id: 336415[/import]

Hi CineTek,

Another method might be to match the character’s velocity to the platform’s velocity on contact, and ensure that the friction of both is sufficient to keep the character from sliding around. You could also attach the character to the platform using a weld joint, and break the joint when the player moves/jumps again. If you’d like to try these, please do, and if they don’t work I can probably think of a couple more options.

Brent [import]uid: 200026 topic_id: 36415 reply_id: 144624[/import]

Another Method is to create a “Joint” between the user and the platform, then when the user goes to jump remove the joint.

Larry [import]uid: 11860 topic_id: 36415 reply_id: 144631[/import]

Thank you both for your suggestions.
I am currently trying to create a joint between the player and the moving platform. But there seems to be an issue - I am using a print statement in order to check if the joint is being created - but it does not seem to have an effect on the player or the platform:

local function collisionA(event)  
if event.phase == "began" then  
 local platform = event.SpriteA  
 if platform.isAttached == false then  
 timer.performWithDelay(10, createJoint)  
 end  
end  
end  

local function createJoint(event)  
 physics.newJoint("weld", platform, player, player.x, player.y)  
 print("joint created!")  
 platform.isAttached = true  
end  

I have no experience with joints so there might be just a simple solution.

regards,

Max
[import]uid: 138330 topic_id: 36415 reply_id: 144896[/import]

Hi CineTek,
You might want to check out the recent tutorials I wrote on physics, as they cover both platforms and weld joints (in the “sticky projectiles” part). There is downloadable code in which you can experiment with all 3 tutorials:

http://www.coronalabs.com/blog/2013/02/19/more-physics-tricks-explained/

Brent [import]uid: 200026 topic_id: 36415 reply_id: 144943[/import]

Hi CineTek,

Another method might be to match the character’s velocity to the platform’s velocity on contact, and ensure that the friction of both is sufficient to keep the character from sliding around. You could also attach the character to the platform using a weld joint, and break the joint when the player moves/jumps again. If you’d like to try these, please do, and if they don’t work I can probably think of a couple more options.

Brent [import]uid: 200026 topic_id: 36415 reply_id: 144624[/import]

Another Method is to create a “Joint” between the user and the platform, then when the user goes to jump remove the joint.

Larry [import]uid: 11860 topic_id: 36415 reply_id: 144631[/import]

Thank you both for your suggestions.
I am currently trying to create a joint between the player and the moving platform. But there seems to be an issue - I am using a print statement in order to check if the joint is being created - but it does not seem to have an effect on the player or the platform:

local function collisionA(event)  
if event.phase == "began" then  
 local platform = event.SpriteA  
 if platform.isAttached == false then  
 timer.performWithDelay(10, createJoint)  
 end  
end  
end  

local function createJoint(event)  
 physics.newJoint("weld", platform, player, player.x, player.y)  
 print("joint created!")  
 platform.isAttached = true  
end  

I have no experience with joints so there might be just a simple solution.

regards,

Max
[import]uid: 138330 topic_id: 36415 reply_id: 144896[/import]

Hi CineTek,
You might want to check out the recent tutorials I wrote on physics, as they cover both platforms and weld joints (in the “sticky projectiles” part). There is downloadable code in which you can experiment with all 3 tutorials:

http://www.coronalabs.com/blog/2013/02/19/more-physics-tricks-explained/

Brent [import]uid: 200026 topic_id: 36415 reply_id: 144943[/import]

Hi CineTek,

Another method might be to match the character’s velocity to the platform’s velocity on contact, and ensure that the friction of both is sufficient to keep the character from sliding around. You could also attach the character to the platform using a weld joint, and break the joint when the player moves/jumps again. If you’d like to try these, please do, and if they don’t work I can probably think of a couple more options.

Brent [import]uid: 200026 topic_id: 36415 reply_id: 144624[/import]

Another Method is to create a “Joint” between the user and the platform, then when the user goes to jump remove the joint.

Larry [import]uid: 11860 topic_id: 36415 reply_id: 144631[/import]

Thank you both for your suggestions.
I am currently trying to create a joint between the player and the moving platform. But there seems to be an issue - I am using a print statement in order to check if the joint is being created - but it does not seem to have an effect on the player or the platform:

local function collisionA(event)  
if event.phase == "began" then  
 local platform = event.SpriteA  
 if platform.isAttached == false then  
 timer.performWithDelay(10, createJoint)  
 end  
end  
end  

local function createJoint(event)  
 physics.newJoint("weld", platform, player, player.x, player.y)  
 print("joint created!")  
 platform.isAttached = true  
end  

I have no experience with joints so there might be just a simple solution.

regards,

Max
[import]uid: 138330 topic_id: 36415 reply_id: 144896[/import]

Hi CineTek,
You might want to check out the recent tutorials I wrote on physics, as they cover both platforms and weld joints (in the “sticky projectiles” part). There is downloadable code in which you can experiment with all 3 tutorials:

http://www.coronalabs.com/blog/2013/02/19/more-physics-tricks-explained/

Brent [import]uid: 200026 topic_id: 36415 reply_id: 144943[/import]

Hi CineTek,

Another method might be to match the character’s velocity to the platform’s velocity on contact, and ensure that the friction of both is sufficient to keep the character from sliding around. You could also attach the character to the platform using a weld joint, and break the joint when the player moves/jumps again. If you’d like to try these, please do, and if they don’t work I can probably think of a couple more options.

Brent [import]uid: 200026 topic_id: 36415 reply_id: 144624[/import]

Another Method is to create a “Joint” between the user and the platform, then when the user goes to jump remove the joint.

Larry [import]uid: 11860 topic_id: 36415 reply_id: 144631[/import]

Thank you both for your suggestions.
I am currently trying to create a joint between the player and the moving platform. But there seems to be an issue - I am using a print statement in order to check if the joint is being created - but it does not seem to have an effect on the player or the platform:

local function collisionA(event)  
if event.phase == "began" then  
 local platform = event.SpriteA  
 if platform.isAttached == false then  
 timer.performWithDelay(10, createJoint)  
 end  
end  
end  

local function createJoint(event)  
 physics.newJoint("weld", platform, player, player.x, player.y)  
 print("joint created!")  
 platform.isAttached = true  
end  

I have no experience with joints so there might be just a simple solution.

regards,

Max
[import]uid: 138330 topic_id: 36415 reply_id: 144896[/import]

Hi CineTek,
You might want to check out the recent tutorials I wrote on physics, as they cover both platforms and weld joints (in the “sticky projectiles” part). There is downloadable code in which you can experiment with all 3 tutorials:

http://www.coronalabs.com/blog/2013/02/19/more-physics-tricks-explained/

Brent [import]uid: 200026 topic_id: 36415 reply_id: 144943[/import]