Rocket jumping & what I'm not getting

» Mon Jul 05, 2010 7:03 pm

Here's a small problem I'm fairly confident could be solved in an instant and that'll leave me feeling really dumb staring at the obvious answer. Anyways,

I wish to create a platformer that allows rocket jumping, this meaning that when the Player fires a projectile at his feet the ensuing explosion propels the character backwards to the opposite direction. As Construct's behaviour mechanics are fairly versatile I'm quite confident it could be done in just a few events with the platform behaviour.

I've got a .cap here. It contains a layout with a simple room and a player character. Left clicking fires a rocket, and when said rocket hits a wall it creates an explosion and also a sort-of blastwave. The latter is an object with a bullet behaviour, set to target the player. When this object hits the player it sends him flying through the air in the same angle... Or that's what should happen, problem being I don't know how exactly this could be achieved. I guess it could be done with the action "set X, Y component of motion" in the player's platform behaviour but I have no idea how to calculate the angle or force for this.

I know this is possibly the simplest stuff but man if I'm not having a hard time with it. Can this even be done with just the platform behaviour or do I have to set up a custom movement of sorts? Help me out!
B
3
G
3
Posts: 10
Reputation: 920

» Mon Jul 05, 2010 7:14 pm

Here you go quick example.

http://dl.dropbox.com/u/1646976/rocketjump.cap

Oh you'll need the latest unstable version form HERE.

Hope that helps.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

» Mon Jul 05, 2010 11:47 pm

Could also set the speeds to the playerdude's current speed + the force speed if you want to be able to boost normal jumps or running speeds.

You can also set ratios by adding multipliers, like the 0.85 below. This would limit higher combined total speeds, so that the resulting speeds are closer together between a standing and jumping boost.

[size=85:qqd8lg3w]+ Force: Force overlaps ForceDetector
-> PlayerDude: Set horizontal speed to PlayerDude[Platform].VectorX * 0.85 + Force[Bullet].VectorX * 10
-> PlayerDude: Set vertical speed to PlayerDude[Platform].VectorY * 0.85 + Force[Bullet].VectorY * 10[/size:qqd8lg3w]

One consideration if you increment the speed instead of setting it to a static speed is the 'overlaps' condition used. Depending upon the settings used, this could be true for several ticks, causing the playerdude to keep increasing speed and rocket away. In that case, you may want to switch to 'on collision'. Or not.
B
3
S
2
G
2
Posts: 187
Reputation: 1,449

» Tue Jul 06, 2010 10:34 am

Well whaddayouknow, I AM feeling pretty dumb right now! Thank you both!
B
3
G
3
Posts: 10
Reputation: 920