moving blocks

Non-platform specific questions.

moving blocks

Postby BogdansB » Thu Oct 27, 2011 8:12 am

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?
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: moving blocks

Postby skydereign » Thu Oct 27, 2011 9:22 am

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");
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: moving blocks

Postby BogdansB » Thu Oct 27, 2011 10:12 am

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?
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score

Re: moving blocks

Postby Game A Gogo » Thu Oct 27, 2011 11:26 am

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!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: moving blocks

Postby BogdansB » Thu Oct 27, 2011 11:49 am

thank u :)
BogdansB
 
Posts: 94
Joined: Tue Oct 25, 2011 2:30 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest