Sonic like movement

For questions about using Classic.

Post » Mon Jan 26, 2009 9:57 pm

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.
B
1
G
3
Posts: 4
Reputation: 833

Post » Mon Jan 26, 2009 10:08 pm

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)
B
3
S
2
G
4
Posts: 271
Reputation: 2,017

Post » Mon Jan 26, 2009 10:24 pm

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.
B
1
G
3
Posts: 4
Reputation: 833

Post » Tue Jan 27, 2009 12:57 am

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.



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
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Tue Jan 27, 2009 3:20 am

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!
B
1
G
3
Posts: 4
Reputation: 833

Post » Wed Jan 28, 2009 8:50 am

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.
B
4
S
2
G
5
Posts: 641
Reputation: 3,011

Post » Wed Jan 28, 2009 10:03 am

Would viewtopic.php?f=8&t=2154 Deadeye's platformer tutorials be of any use?
B
2
S
2
G
3
Posts: 158
Reputation: 1,566

Post » Wed Jan 28, 2009 12:40 pm

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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Jan 28, 2009 12:47 pm

I'm not sure I follow why a Sonic game would be so different from any other platformer...
B
2
S
2
G
3
Posts: 158
Reputation: 1,566

Post » Wed Jan 28, 2009 1:01 pm

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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests