Weird slope behavior [Solved]

Just started using Construct 2? Post your questions here

Post » Fri Sep 16, 2016 1:12 pm

Hello everyone :D

I read a bunch of stuff about slopes around here, but most of them is related to how to set the angle to match the slope, which is not the case here.

I'm developing this game that kinda looks like Mega Man X, and I'm trying to set some slopes so the player can move up and down on the stage without the need of jumping a lot.

Just setting the slope as a sprite and adjusting the hit box is working fine most of the times but the problem is, my character has a fall and landing animation and every time I'm moving on a slope instead of just moving, there are also some random falls, which completely ruins the game play since have a fall and landing animation randomly happening in the middle of a run or whatever is really ugly and annoying.

The hit box of the slope is the default bounding box but with one less point on it, so I'm assuming it is a 45 degree angle, and the player has a squared hit box for all frames of all animations.

Is there any other way to work with slopes? Is this common to construct2? Is there a specific way to set the hit boxes to avoid this kind of behavior? Has anyone else faced this?

Thank you very much for you attention :D
Last edited by RayKi on Sat Sep 17, 2016 5:16 pm, edited 1 time in total.
Posts: 280
Reputation: 2,522

Post » Fri Sep 16, 2016 7:12 pm

I haven't tried this in Construct 2 specifically, however this concept is more theoretical so it should apply just fine in Construct 2.

Your problem is the player's sprite's collider set as a box. Since the floor is a slope and the player's collider is a box, this happens. To evade this problem change the bottom part of the collider to be more like a circle. This would nullify the "falling" and ugly stuff that happens.

That said, if you are using Physics then you may want to make sure that your collider is balanced so the sprite doesn't fall when moving/standing still (i.e. the right side of the sprite is exactly equal and identical to the left side).

You can achieve this two ways:
1- Editing the sprite's collider directly and try to make it a bit spherical at the bottom (not really recommended).
2- Create your player sprite, remove its bottom collider part. Create another object that is invisible and pin it to the player's sprite. In the new object, set the sprite's bounding box to look as spherical as possible.

Hope that helps!
Posts: 161
Reputation: 1,751

Post » Sat Sep 17, 2016 5:16 pm

Well, setting the bottom collider to a spherical shape did not help at all. However editing the collision box helped me realize that small 1px changes between one animation and the other were causing this problem.

Actually, even inside the animation it self, if the half of the collision box that was drawn after the origin point had a different size than the left half the movement wouldn't be smooth and cause the random falls.

After adjusting the hit box of each animation TT.TT The game and its slopes are working just fine.

Thank you very much for the support, you shed light to a matter I couldn't see before and it helped me a lot.
Posts: 280
Reputation: 2,522

Post » Sun Sep 18, 2016 8:10 am

the fool-proof way is to have a rectangular sprite as the behavior hitbox, then pin the graphics over it.

"Implementing reliable platform movements
For the most reliable platform movement, it is recommended to use a invisible rectangle sprite with no animations with the Platform movement. Then, the animated player object can be positioned on top of that. Otherwise, the changing size and collision polygon of the object as its animation plays can interfere with the Platform movement's floor, wall and slope detection, causing a shaking or glitchy movement. For more information and a complete guide, see the tutorial How to make a Platform game."

source :
Game design is all about decomposing the core of your game so it becomes simple instructions.
Posts: 2,123
Reputation: 17,200

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests