This site requires JavaScript, please enable it in your browser!
Greenfoot back
kartikitrak
kartikitrak wrote ...

2012/6/8

Moving on a moving platform

kartikitrak kartikitrak

2012/6/8

#
At the moment when my actor reaches the platform he can stand on it but as the platform moves, the actor doesn't move. Whether it be moving from left to right or up and down how do I go about making it so as the platform moves the actor moves with it.
kartikitrak kartikitrak

2012/6/8

#
Never mind. Solved the problem.
kartikitrak kartikitrak

2012/6/9

#
Take that back. It's not working. Additional information: My collision detection uses color detection. The platforms are red and if he's on a red platform, I would like the actor to move with the platform. Also, I'm having a problem where my actor jumps from too high at a moderate velocity but always goes through the floor. Any solutions?
Moritz Moritz

2012/6/9

#
public void platform() { Platform platform =(Platform) getOneIntersectingObject(platform.class); if (platform !=null) { dx=platform.dx; dy=platform.dy; // int a=platform.getY(); // setLocation(getX()+1*dx,a-36); } } the "int a= platform..." is not important for that. Important: the snake has to be a subclass of the block!!! do you have a code for the block?
Moritz Moritz

2012/6/9

#
and you have to use dx and dy in your platform code... sorry - i mean " do you have a code for the platform"
danpost danpost

2012/6/9

#
I would not be difficult to have the platform move the actor when it moves, if the actor is on it. That way, the actor would still have independent movement on the platform. For the through the floor issue, use a 'for' loop to iterate through the number of individual steps in the move; checking for intersecting objects each step.
You need to login to post a reply.