How do I make a semi-static moving platform?

  • Hello everybody,

    It's possible to move a platform, like sine behavior? I can't use sine behavior, because I use only physics behavior.

    Whatever, here is a example: My layout is loaded and all objects are ready. Maybe it can be, that a object has got a random state (call it "RESTLESS"). Ok, so if RESTLESS is true, than do this:

    Of course, the platform can also move from top to bottom. Is that only possible with lerp?

  • You can use Physics->Set velocity

    It's almost the same as setting Bullet speed, only it works correctly with physics objects.

    For sine movement you can add Sine behavior, but select "Movement=Value only" in properties.

    Then on every tick do Physics->Set velocity to (Self.Sine.Value)

    Alternatively, you can move your platforms using forces, impulses, gravity, linear damping etc.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can use Physics->Set velocity

    It's almost the same as setting Bullet speed, only it works correctly with physics objects.

    For sine movement you can add Sine behavior, but select "Movement=Value only" in properties.

    Then on every tick do Physics->Set velocity to (Self.Sine.Value)

    Alternatively, you can move your platforms using forces, impulses, gravity, linear damping etc.

    And you'll probably have to compensate for gravity in your Y velocity, to keep the platform from falling.

  • dop2000: Thanks for your answer, but I won't use the sine behavior. The problem with this behavior is, that's the player is everytime falling trough the platform. I have the same problem from my last post. As soon as the platform moves, the player falls through.

    brunopalermo: I can not change gravity, because the player can't be controlled anymore.

    ~edit:

    Ah ok, I forgot to pin the player.

    But there is still a little problem... Is there any way to stop the sine behavior immediately?

  • wossi

    The player was falling through the platform because you were moving the platform with Sine behavior.

    What I'm suggesting is that you use Sine behavior only to calculate the value. And then use this value to move the platform with Physics action "Set velocity".

    Pin is also a non-physics behavior and you should avoid using it with physics objects.

  • dop2000:

    Here is my "little" problem:

    ...and that's my events, if player has landed successfully on the platform:

  • I'm pretty sure your obj_player is not sleeping, so this whole event doesn't work.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)