Jump from anywhere and land in a certain spot

0 favourites
  • 6 posts
From the Asset Store
John is a fearless pirate and has ventured to seek treasure in uncharted lands
  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • 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!

  • 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)

  • 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

  • Thanks guys! I have a few was of going about it now thanks to your help :)

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