Sonic like movement

This forum is currently in read-only mode.
From the Asset Store
Hybrid Sonic Branding Kit is a business identity & motion graphics sound effects library.
  • Hello

    I'm new to construct and i've been using it for about 2 weeks now. So far I love it! But I've run into some problems with getting my character to rotate at slopes to a correct angle. Any tips would be greatly appreciated!

    Thanks in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm. If I had to guess ...

    You have an animation of your character rotating and if you match the character's speed with the animation speed then it looks good and works on flat ground. Then you get to an incline and it looks like he's slipping.

    I think that's because "speed" sets the x speed. (At least this is the case with the platform movement using slopes like in deadeye's platform tutorial.) So when you encounter a slope you keep the same speed in the x direction but you pick up some speed in the y direction. The result: a higher total speed.

    I would try to solve this by decreasing you're character's speed when he reaches an incline.

    try setting

    player.speed = (player.speed)*cos(player.angle)

  • Hi, thanks for the fast reply.

    I might have been a bit unclear about my problem. My character isn't rotating constantly, I just want to change his angle depending on the angle of the slope beneath him (sonic like movement). As for instance, if a slope is 45 degrees, I want my character to rotate 45 degrees to get the same angle as the slope. And I don't want it to be like deadeye's platform tutorial where the angle is already preset. I'm aiming to do a "slope detector" so the slope detection is checked constantly.

  • i dont wanna bring you down or anything,but a complex custom movement like sonic is a pretty advanced thing, and not the ideal thing to do when you dont even know where to start :p

    its not impossible believe me, but it requires alot of thinking to get things to work like you want them to.

    now i know how to do this, but its by no means for beginners. it requires a lot of complex stuff.

    me and davios tank movement engine is a crude example of what youd need (its in "your creations" subforum)

    im not trying to make it seem hard, its not the most difficult thing you can do, but what im saying is making a sonic style movement isnt where you should start, this is THE generic "i wanna make an RPG" dilemma.

    anyways, back to helping you out lol

    now if i remember sonic doesnt have real terrain finding like you wanted. it has terrain slopes which are (* is short for degrees) 0*,22.5*,45*,67.5* ect (they are in 22.5 degree increments which creates the illusion of smoothness), it doesnt have smooth terrain. so that means it does work somewhat like deadeyes example. ontop of these 22.5 degrees terrain things, it has quarter circles, and quarter pipes (for things like those rolling hills, and of course loops (although loops are a somewhat prescripted event.)) now all of these things are 100% possible in construct, and making a sonic engine that works excactly like the original is not as hard as i previously mentioned (but still somewhat difficult). if you understand Cos and sin and are pretty fluent in math it should be relatively easy.

    <img src="http://www.trustedreviews.com/images/article/inline/7071-Sonic2.jpg">

    like you can see here, the terrain is in 22.5 degree increments, the majority of the slope is 45*, then there is a 22.5 at the top, which transitions into a 0*, and at the bottom 22.5* which again transitions into a 0*

    making a custom plat movement that uses sloped like this is pretty easy, but youll need to figure things out yourself, as its tedious and i dont want to explain it here

    as for loops and hills, i have a .cap lying around that should make understanding how to do them pretty simple, but its on my other computer so i cant get it now.

    anyways good luck

  • Hey

    I had a feeling that this might be a difficult task, but unfourtanely i dont see any way around it if we want to finish the game. I think we got the sonic way of doing it down (atleast to some extent) , but i believe it will have to be some sort of terrain finding system to work properly... Since the ground on which the player will be moving is animated with bones the angle of the terrain will change constantly.

    We tried putting physics behavior on the detection box and having two boxes on each side of the detection box too keep it from spinning around completely when confronted with too steep slopes, but it didn't work out quite as planned. But your tank example seemd to pull it of nicely... looking forward too seeing updates on that!

    Thx for your detailed reply!

  • Sorry its not commented, but basically you have a sensor to the left and a sensor to the right, and you make them go downwards until they touch the ground, then make the sprite of the player be at an angle which is between those two points.

  • Would Deadeye's platformer tutorials be of any use?

  • Well, he already said he didn't want to do it that way.

    Anyway, I think using Platform behavior to create full on Sonic-style movement, with loops and everything, is pretty much an exercise in futility. Fundamentally it's a completely different style of movement, and you'd have to wrestle with too many factors just to cancel out and overcome the basic Platform behavior itself.

    A Sonic engine would more likely have to be 100% custom to work well and properly, and that's not something easy for a beginner to tackle.

    Though maybe with the new Custom Movement behavior (or whatever it's called) coming soon, it might make at least doing the controls, speed, and collision easier, if not the loops themselves.

  • I'm not sure I follow why a Sonic game would be so different from any other platformer...

  • Can you think of an easy and efficient method to translate the horizontal movement (and input) of the Platform behavior into rotational movement around a loop? I can't. It just seems to me that you'd need to fudge with the speed and gravity settings of the Platform behavior way too much. I mean, when you press left, the Platform player moves left... how do you tell it you want to move Up or Right instead, and make the transition seamless around a full circle? Yeah, it's probably possible, but that's so many basic functions of the Platform behavior that you're making workarounds for that it hardly seems worth it to me. If you have to change the fundamental movement so much, you might as well go completely custom and save yourself the headache.

    I'm sure Quazi could, though.

  • Hey!

    Thx alot David! Thats exactly what we needed! Will try to implement it tonight!

    Deadeye: Yeah your probarbly right about the custom movement. Not sure we will be using any loops though... but probarbly lots of other stuff that will screw with platform behavior. We are probarbly going to stick with platform behavior until we find out what you already told us

    Btw thx for the tutorial, it has been very useful even though we didn't want the slope solution!

  • So it's a Sonic like movement minus the spinning and the loops. Got it.

  • david's example is basically how the tank works, but in a simpler way.

    the only prob with his example is he only uses 2 samples, which would make a sharp variation look weird, id use 5, or even 10.

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