Step one:
-> Give the Ground a behaviour of solid
-> Give the Character a behavior of platform
Step two:
-> Adjust the collisions of the Ground and the Character, but don't use too many collision dots as they can slow down your game.
Step three:
-> Create two sprites, which will simulate sensors, put one sensor to the left at a desired distance from the character and it needs to be a bit below the characters' feet and call the sensor sensor_left
-> Do the same for the right sensor, except it goes to the right and you can call it sensor_right
It should look something like this:
Step Four:
-> Add a behavior of Pin to each sensor
Step Five:
Go to the event sheet - System -> on start of layout | Pin the sensors to the character at position and angle
Step Six:
Now what line 5 does is: It checks every tick if the right sensor is in collision with the ground, and if it is, it will rotate the character to the left for -0.7 degrees (negative angle value) every tick (1/60th of a second) until the right sensor isn't in collision with the ground anymore.
Now what line 6 does is: It checks every tick if the left sensor is in collision with the ground, and if it is, it will rotate the character to the right for +0.7 degrees (positive angle value) every tick (1/60th of a second) until the left sensor isn't in collision with the ground anymore.
Download the .capx I provided and try it out and play around a bit to get a deeper understanding of how it all works
Hopefully, this has helped you :-)