Trying to get Foozle CC's edgeGrab to work

1 favourites
  • 3 posts
From the Asset Store
_______ Huge collection of metal fixtures ________
  • Hello, I am currently trying to make a 2D platformer racing game and wanted to include some parkour mechanics. One of those mechanics is a ledge grab. When looking for one, I found Foozle CC's video on a platformer state machine, which contained exactly what I needed.

    I watched that video three times to try to understand the code he had before downloading the example project so I could try to recreate it.

    Now I have almost the exact same code on my character as he has on his but for some reason my character doesn't grab the ledge when facing left and when it does grab the ledge when facing right sometimes it will float above the level instead of staying in place next to the ledge.

    I have created a sample project with my character and code and Foozle CC's character and code in the same level to show my problem. Thank you to anyone who can help me.

    Here is the sample project https://drive.google.com/file/d/1YyqaSQoN4wvrE6H_cIyAGTJ57LoqX4TQ/view?usp=sharing

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I genuinely don't know what I am doing wrong. I use the exact same code with the exact same sprite size and origin point. I at least now know that when I up the edgeDistTolerance to 17 or higher then ledge grabbing while facing left works. The issue with that is that it raises the edgeDistTolerance for both facing left and right and makes everything get confused when I press left while facing left and grabbing the ledge.

    Someone please help I'm going insane.

  • When P1 sprite is mirrored, its width is a negative value. So (P1.X-(P1.Width/2)) really becomes (P1.X+(P1.ImageWidth/2))

    Instead, use BBoxLeft and BBoxRight expressions.

    Level.TileAt(Level.PositionToTileX(P1.BBoxLeft-edgeDistTolerance),Level.PositionToTileY(P1.Y-10))

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