How do I create a moving platform in a top-down game?

0 favourites
  • 7 posts
From the Asset Store
Set of tiles to create a map for top-down games with island theme
  • I am making a top-down game where the player uses the 8-direction behaviour (it's actually a pseudo-3D game, but it works just like a top-down).

    I am trying to make a moving platform that the player can step on and move along with it, at the same time the player can control the character and move on top of the platform.

    I was able to make the platform move with no problem, but I cannot figure out how to get the player to move with it without locking it to the platform.

    Any ideas?

    Screenshot of my code for the moving platform so far:

    Screenshot of the game:

  • If you pin the player to the platform when no movement key is pressed, and then when movement key is pressed unpin the player, that might have the desired effect.

  • Thanks, lionz! I will give it a try later today and let you know if it worked or not.

    Another thing that I thought of that I apparently forgot to mention in the post: any ideas on how I can keep the player within the platform even though they're moving?

    As in, they're on top of the platform, in the middle of their trip from point A to point B, and they can freely move, but they cannot go off the platform until it arrives to its destination.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can create an invisible border of sprites around the platform that have Solid behaviour and enable them when the player is on board, disable when it reaches the destination.

  • So, I tried the pin/unpin approach and it partially worked. The player did, in fact, move along with the platform and I was able to move while on the platform.

    However, seems like the player's speed is reduced and for some reason, the platform only moves the player if its sprite is on one of the edges.

    For example: if the player is moving from left to right, the platform will only move the player when the latter is at the left edge of the platform, meaning that the platform will move without the player until the player hits the left edge, and only then the player will move with the platform. From right to left, the opposite is true.

    Any clue on what could be causing that? I know that in the screenshot I am using a boolean to pin the player to the platform, but I also tried checking for the movement keys not being pressed and it didn't work.

    Code screenshot:

    Game screenshot:

  • The player needs to move faster than the platforms or probably there will be an illusion that the player is stuck because you can never catch up with it.

  • I am replying a bit late as I was taking a break from the project. Now I am getting back to it.

    I understand that I need to increase the player's speed to compensate for the platform's speed. That will be implemented soon.

    The main problem that I am struggling to figure out is why the problem in the video is happening. I checked on debug mode and apparently the player is pinned to the platform regardless of where on the surface of the platform he is, but he only gets carried over once he's at the edge of the platform.

    Link to the video:

    youtu.be/M7Y5EUZIrnk

    Any clue why that could be happening?

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