How do i stop movement on the edge of a platform(4 directions/ Top Down)

0 favourites
  • 5 posts
From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • Hello, I’m looking for an alternative method to using the solid behavior. I am making a 4 directional game and I’m trying to achieve something like hyper light drifter or moonlighter where the character will stop at the edge of a platform and has to dash over to move to the next platform .

    My issue is when using the solid object it makes players bounce and glitch around.

    Yes i can make an invisible sprite that stops movement when overlapping but how can i allow the player to move the other direction when it is overlapping?

    The solid behavior makes everything bounce off and go in weird directions I’m looking for some code that just stops movement when colliding at a certain point but the player can always turn around and go the other way

    Just for clarity the space between platforms would be somewhere the player could fall if he doesn’t dash properly

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi longghead. The bounce and glitch around, I'm assuming is because of the collision polygon that changes every frame. A usual approach is to create a simple sprite collision box and pin the character to that object. What you control is the box, which will be invisible throughout the game. You can still test for collisions with your pinned character, but for movements, there won't be any bouncing around since it's square/rectangle that is consistent/not changing.

    Is that what you meant by the invisible sprite? It actually seems like it, but I don't understand what you mean by allow other player to move the other direction. It should be able to move in any direction except when the direction is blocked by a solid.

  • What I’m looking for is a way that when the player reaches the edge of a platform, they will stop moving(in that direction). But they can turn around and go the opposite way. In the picture i included u can see a the character can walk to the end of the platform, if he wanted to get over to the other side he would have to dash.

  • there are many ways to do this. One way is as I mentioned before. Collision box, which is what you move, and pin the character sprites on it. You should stay within the solids without any jumps/jerks, and turn around the other direction if you wish to.

    As for the dashing through, it's hard to tell without seeing your code. But building off the the previous example, you can use collision filters to enable passing through certain solids when the dash variable flag is enabled/animation is playing.

    Here's a basic example:

    drive.google.com/file/d/13yAh0cmCKkCczl_NLz5O7Wju_KbJVvcY/view

  • there are many ways to do this. One way is as I mentioned before. Collision box, which is what you move, and pin the character sprites on it. You should stay within the solids without any jumps/jerks, and turn around the other direction if you wish to.

    As for the dashing through, it's hard to tell without seeing your code. But building off the the previous example, you can use collision filters to enable passing through certain solids when the dash variable flag is enabled/animation is playing.

    Here's a basic example:

    https://drive.google.com/file/d/13yAh0cmCKkCczl_NLz5O7Wju_KbJVvcY/view?usp=sharing

    Thanks for your help! I see how I will implement it now, thank you! I have another thread open about enemy ai taking different paths to get to the player, if you know any way to do this please reply in that thread

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