get slope of floor in platformer Games

0 favourites
  • 7 posts
From the Asset Store
Easily generate many levels from a set of pre-built scenes (Construct 3 template)
  • Hello my dear friends

    firstly sorry for my bad English

    I am new in construct and lately i worked with UDK

    as i learned in UDK you can get slope of floor that your player is standing on as a floor property in pawn class

    but how can i force my player to slide on some angle?

    I know that using of physics my be the first solution that every body think about it, but my game design is like a platformer character

    and adding physics to my character make it behave like a physical character

    my question is this:

    is there any way to get the angle of the slope of the floor that my player is standing on?

    thanks for your time and attention

  • if your floor is made of sprites giving a graphical representation of a slope then you can give the sprite a variable based on that angle...

    so if your slope is 45 degrees set the variable to 45...

    then you can set the players angle based on that variable when he is stood on it..

    remembering that 0 degrees is to the right,imagine East on a compass so 45 degrees would be South East on a compass, you would have to do a calculation to get the correct angle...

  • That's kind of a tricky one. You could easily find the floor object that's nearest to the player, and get its angle that way, but that works with the floor object's origin which might not always actually be nearest to the player (there could be another floor object's origin that's closer).

    A way around this would be to keep your objects relatively small, which you can see in this example based on the platformer template.

    Although that's not the most elegant or efficient solution, it might work for you depending on your design approach. I'd welcome any other ideas on the topic as it's something I might find myself facing one day.

  • I'll bet that you could modify the platformer plugin to return the floor slope, as it seems to use that value to determine whether it's on a slope or a wall.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you're using collision tiles just check which one the player is overlapping at 0,1 and go from there. If not, try creating two detector objects to the left and right of your player that conform to the floor, get the angle between them, then set your player to it.

  • Ah, Tokinsom, you're spot-on. I always forget about overlapping at offset. Thanks for that.

    Redcapgame, I've updated my example based on Tokinsom's suggestion.

  • firstly lets accept my special thanks about your kindly responses.

    dear Pixel perfick in my opinion this solution really is hard for our level editors to manage such a idea

    dear sqiddster i am going to test that but unfortunately i can not find some way to detect floor angle

    dear Tokinsom i will check your solution

    and dear GeometriX really thanks for your response i will check your file and tell you the result

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