Legacy GM Stay on a platform that moves with a path

E

Eye_Hat

Guest
I have a platform that moves through a path, when the player is over and the platform moves, it doesn't follow it.
I have tried adding the speed vertical and horizontal of the path to the player, but there is no variable that contains that data.
Code:
if (physics_test_overlap(x, y+1, phy_rotation, obj_Platform)) {
    phy_speed_x += other.hspeed;
    phy_speed_y += other.vspeed;
} //Doesn't work
Note: Room is Physics World.
 
Last edited by a moderator:

Roa

Member
I was going to help you until I saw the phyics part.

Can't you just apply force in the same direction?

I thought you couldnt use both speeds varaaibles and physics with force?
 

Bingdom

Googledom
Im pretty sure vspeed and hspeed don't work in a physics world
try using other.phy_speed_x and other.phy_speed_y instead.
 
E

Eye_Hat

Guest
No matter if I put hspeed and vspeed or phy_speed_x and phy_speed_y. All are 0.
 

Yal

🐧 *penguin noises*
GMC Elder
Is the player a physics object? If friction is sufficient, it should stick on the moving platform automatically if both are physics objects.

Also, let me shamelessly plug my MariaEngine, it has support for arbitrary moving platforms!
 
E

Eye_Hat

Guest
Yes, the player is a physical object. But if I add friction player can't move.
 

Yal

🐧 *penguin noises*
GMC Elder
They can move even under friction... you just need to exert more force than the friction absorbs.

If you're going to simulate physics, you probably should start by reading up on how they work...
 
E

Eye_Hat

Guest
Okay, How can I know how many force should I add without speed variables?
 
E

Eye_Hat

Guest
I have different paths with different speed each one. It has to be automatic.

Dead link.
 
E

Eye_Hat

Guest
The friction does not work, it seems that it slides completely. I think when starts the path loses the physics properties.
 
E

Eye_Hat

Guest
Code:
if (physics_test_overlap(x, y+1, phy_rotation, obj_Platform)) {
  phy_speed_x = lengthdir_x(abs(other.path_speed),other.direction);
  phy_speed_y = lengthdir_y(abs(other.path_speed),other.direction);
}
Now stays on the platform, but there is a problem. The platform changes direction one step before the player and that gives errors.
I've tried a lot of things but it's always the same. The player isn't still because there is a mismatch in the speed changes.
 
Top