Jump from anywhere and land in a certain spot

Get help using Construct 2

» Sat Dec 29, 2012 4:39 am

Heya,

I am using the platform behaviour and I'm just trying to make it so that when the player is near a bush and they press a certain button, they will jump towards the bush and land exactly on the bush's position. I managed to get it to work in this capx, but I don't like the way the player just stops dead when they are above the bush. Does anyone know how I can make it so that the player will jump in a nice arc and still always land in the right position?

Any help would be appreciated!
B
28
S
8
G
5
Posts: 429
Reputation: 7,027

» Sat Dec 29, 2012 12:18 pm

I'm not at home so I can't really try it out :( my first thought however is that you might want to try LERP. don't exact me on this. This is just hypothetical :D

setVelocityX(lerp(0, distance(player, bush), 0.5))
if this works this of course this still means that if the player is over the bush he will stop mid air. however it should scale the velocity so that if there is distance between the bush and the player. the player should land on it. tweak for desired effects...

assuming this works :D Good luck
B
94
S
18
G
9
Posts: 2,457
Reputation: 15,167

» Sat Dec 29, 2012 1:39 pm

Hey @jayderyu,

Thanks for the advice, but there isn't a a velocity option I can find. I take it I can just use speed though right? I tried it out and it kinda works, but at the moment a bit bumpier than my original method. I'll try tweaking it a bit!
B
28
S
8
G
5
Posts: 429
Reputation: 7,027

» Sat Dec 29, 2012 3:45 pm

Here's how I would do it, when you're within a certain distance from the bush you trigger a scripted jump that controls the X vector of your character and makes him land on top of the bush.

Example: JumpToPosition.capx (r114)Nimtrix2012-12-29 15:45:34
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

» Sat Dec 29, 2012 5:26 pm

That is a good point that Nimtrix brings up. To what effect is this required for.

Nimtrix model is a great simple hopper.

Where as what I was trying to toy with was for something else as in trying to land on a small point from a long jump. Similar to how in Assasins Creed Altair manages to hop onto small poles.

Also I got home and your capx isn't working for me. Getting some sort of caproj information missing ;( yes, I didn't have access to C2 and wasn't sure if platform had speed or velocity. I though Platform had velocity, but looking at it now I was getting Vector and Velocity mixed :D

You could also try to use lerp/distance and gravity so the the character comes down quick as needed. then restore gravity upon landing.

You could alter the Y vector to increase downward momentum, or X to shorten distance.

With nimtrix and my suggestions I think you can probably muddle a good solution :D
B
94
S
18
G
9
Posts: 2,457
Reputation: 15,167

» Sun Dec 30, 2012 4:58 am

Thanks guys! I have a few was of going about it now thanks to your help :)
B
28
S
8
G
5
Posts: 429
Reputation: 7,027