how to make a sonic style spring

Discussion and feedback on Construct 2

» Fri May 12, 2017 3:04 am

I am making a small fan made sonic game and I am needing springs to get up to higher areas. How to I add physics to launch sonic on the angle that the spring is facing
B
8
Posts: 11
Reputation: 322

» Sat May 13, 2017 7:54 pm

That's not an easy question to answer. One way is to give the spring an instance variable with how fast it should launch Sonic (for example, "launchSpeed"). Then if you're using the Platform behavior, you can set Sonic's Vector Y to "launchSpeed*sin(spring.angle)" and his Vector X to "LaunchSpeed*cos(spring.angle)" (you might have to play with minus signs to get those equations right).

If you use this method, it will be important to set Sonic's deceleration relatively low so you can really see him move at an angle. Also, you will need to shape the spring's hitbox a special way or find some other method so the spring only triggers when Sonic hits the top and not the bottom or sides.

But overall, making a Sonic engine on C2 isn't very easy. There's one somewhere in the forums that works well, but if it were easier, I'm sure we would see tons of Sonic or Sonic-like games on the arcades. That said, don't let my nay-saying stop you.
Eh, Steve!
B
118
S
54
G
13
Posts: 115
Reputation: 16,244

» Thu May 18, 2017 4:48 am

are the springs all going to boost them the same amount? If so, could do something along the lines of, On Collisiion- Set Jump Height To (NewJumpHeight), Simulate Control - Jump, Set Jump Height (Original JumpHeight).
B
28
S
14
G
1
Posts: 148
Reputation: 3,218

» Thu May 18, 2017 4:50 am

If seperate springs, I suggest the same but adding pick by UID, however pending what youre working with that may take up several events for several springs, which isn't always ideal.
B
28
S
14
G
1
Posts: 148
Reputation: 3,218

» Thu May 18, 2017 8:49 pm

Here is a link to what I assume one of the posters above meant when he mentioned a sonic engine of sorts
behavior-sonic-physics_t150606

He even mentions wanting to incorporate/create springs eventually. Maybe you could ask him about it.
B
9
S
5
G
2
Posts: 11
Reputation: 1,897

» Thu May 18, 2017 11:39 pm

I am using this behaviour It work really well
B
8
Posts: 11
Reputation: 322

Who is online

Users browsing this forum: No registered users and 2 guests