Need some help with the "platform" behavior and collisions

0 favourites
  • 11 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Hello, I am using the "platform" behavior in the following game: ... index.html

    Sorry, but I can't share the .capx file since my engine is almost complete. The [player] has "platform" behavior, the moving blocks have 2 "sine" behaviors (horizontal and vertical), and the brown block is "solid", there is no extra events/code involved.

    I've encountered the following issues when the [player] is above a moving platform and collides with a [solid] object.

    1) In the layout "case1" when the object [player] stays on the moving [block] and is colliding with the solid [ground] the following happens:

    • on collision with the right solid [ground] -> the [player] is moved 1-2 pixels down
    • on collision with the left solid [ground] -> the [player] is moved 1-2 pixels up

    2) The layout "case2" is similar to "case1", but the [block] is moving on diagonal and is moved (wrong placed) away when colliding with solid [ground]

    3) In the layout "case3". How I can make the [player] to move/stay on the platform that is moving up (above the one that the [player] is standing)

    What can I do to fix these issues ?

  • For me, the player gets put inside the moving platforms.

  • I've added animations in the first post

  • Anybody ?

    I was thinking to check the collision at offset and move the player in the opposite direction where the moving [block] is going.

    How do I calculate the distance the block (with sine behavior) in moving ?

  • I've fixed case 1 and 2 with the following events:

    It still hang/hooks a little so if someone knows a better method or what I should modify it would be great

  • Learn more with demos:

  • Learn more with demos:

    The link doesn't work.

  • TGeorgeMihai check again works fine

  • TGeorgeMihai check again works fine

    Works for you because you are logged into your account. Try to open the link in private/incognito tab (or not logged in).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • So sorry

  • tgeorgemihai

    I think the jump is related to how the behavior finds the closest free spot to resolve a collision. It does checks in kind of a spiral at times from what I understand, which is decent for arbitrary object collisions but not so much when hitting a flat wall it would seem.

    I can't think of any solutions offhand to fix the little jumps other than just implementing the movement from scratch to have more control.

    Here's my go at it that works similar to the platform behavior but only works with un-rotated boxes.

    The cyan box is the one done with events and the grey one is the platform behavior for comparison. ... _plat.capx

    The basic loop is

    1. move with any platforms the player is known to be on

    2. move based on controls and based on what sides of the player is blocked

    3. resolve collisions by moving the player box out the closest direction of the wall boxes.

    4. mark the walls the player has around him and stop velocity in those directions.

    It does have room for improvement, like anything, but it works ok. The cases when the player gets trapped will need to be handled.


    For the sine behavior you can find the distance moved by adding two variables ox and oy to the object and then in "on created" and an every tick at the bottom of the event sheet set ox and oy to the object's x an y. The the x and y distance moved would be x-ox and y-oy respectfully.

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