Page 1 of 1

moving blocks

PostPosted: Thu Oct 27, 2011 8:12 am
by BogdansB
HI,
I made a block wich is moving to the left and right automaticly. now I want to make that if i jump on him, the player stands on this block. i tried it, but the player does't moves with the block, you need to press right and left , so he can stand on him, otherways he falls down.

how can i do that he stays on the block automaticly when i jump on it?

Re: moving blocks

PostPosted: Thu Oct 27, 2011 9:22 am
by skydereign
A quick way to do it is to on the collision event, change the player's parent to be the block you are colliding with (changing it back to none will reverse it).
player -> Collision with block (top side) -> Script Editor
Code: Select all
ChangeParent("Event Actor", "Collide Actor");

Re: moving blocks

PostPosted: Thu Oct 27, 2011 10:12 am
by BogdansB
ok, it works. and if i want to annul this if he jumps off?


Collision finish -> script
Code: Select all
ChangeParent("Event Actor", "(none)");


right?

Re: moving blocks

PostPosted: Thu Oct 27, 2011 11:26 am
by Game A Gogo
Should be right, but I bet the player will still fall off, try creating a filled region over the block, but make it a couple of pixel bigger. Parent this region to the block, and your collision event should happen towards that filled region instead of the block. Because the player bounces on and off constantly (You can't see it, it's less than a pixel, but enough to trigger collision finish) with physical response, thus making it fall off, but with the filled region, even if he bounces slightly, he will still be colliding!

Re: moving blocks

PostPosted: Thu Oct 27, 2011 11:49 am
by BogdansB
thank u :)