How do I stop the player from falling off a platform?

0 favourites
  • 4 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Hi.

    I'm curious on how to do something.

    I have my player character (has the platform behavior) standing on a platform, they're able to move along it normally. Now when they get to the edge of the platform I don't want them to fall off, I want them to just stop right at the edges of it. Know what I mean?

    Yes I thought about adding an invisible solid object to the edges of the platform to keep the player "inside" the platforms' boundaries, but for reasons that affect other areas of the game I CANNOT make those edge markers solid.

    Any other less obtrusive ways to pull this off?

    I thought about adding something like 2 image points to the edges, but not sure how I could get the character to stop moving like that.

    Thanks for any help

  • You have to know the x coordinate meaning the start and end of the platform. If play.x < platform.x.start or player.x > platform.x.end then play.x doesn't move

  • Hmm, don't understand really. Not sure what you mean by platform.x.start. Construct throws an error if I try to add a value after an objects X.

    Tried imagepoints instead.

    player.x > than platform.imagepointx(0)


    player.x < than platform.imagepointx(1)

    Set Platform Maximum Speed to Zero

    Will result in... nothing happening. I'm also not sure how I could resume the players movement if I'm stopping them once they hit the edge. Could you possibly explain further?

    Thanks for helping, it appears to be fairly simple but I've always struggled with some of C2's more basic concepts lol.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That was pseudo code so it is not code that C2 will understand.

    Try to store in a variable the start x coordinate of the platform and store in another variable the end x coordinate of the platform then compare with player.x

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