Character jump smoothly to specific spot

1 favourites
  • 9 posts
From the Asset Store
Jump on candies, collect candies and earn score!!!
  • Hello,

    I am trying to have a character jump smoothly to a specific spot. From there, the character should jump smoothly to the next spot.

    So far I tried pathfinding, 8way movement and platform behavior but it doesn't really work the way I want.

    The idea is it that I have four holes in the ground where a boss enemy jumps out from one and into the next hole. Since there are four i want the boss to randomly spawn and pick a random hole, so the distance should be different, otherwise it would be easy XD

  • Hey EzekielRage,

    Sorry for the delay I failed my first attempt to do this :-P

    You can create an algorithm that moves your boss side to side and up and down using lerp.

    I made a video that explains it (pretty well? I hope):

    youtu.be/HslLOaD87jA

    Or you can use my code and plug and play:

  • You could probably adapt this

    howtoconstructdemos.com/trajectory-calculation-two-methods

    Shoutouts to dop2000

  • That particular demo is not mine and it's a bit too advanced for this task.

    I would probably use Bullet behavior with gravity, there must be a simple math formula to calculate bullet speed to land at the particular spot.

    Another easy option is running two tweens - one to move horizontally, and the second one with "ping-pong" setting to move up and then down.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here's the equations. t is how long you want it to take to get there in seconds. And mouse is the destination spot. Probable can put it into a function for easy use.

    var t=1
    On click
    -- set speed to distance(0,0,(mouse.X-Self.X)/t, (mouse.Y-Self.Y)/t-0.5*Self.Bullet.Gravity*t)
    -- set angle of motion to angle(0,0,(mouse.X-Self.X)/t, (mouse.Y-Self.Y)/t-0.5*Self.Bullet.Gravity*t)
  • R0J0hound

    Hey R0J0hound - did you come up with the (-1+4(self.t-0.5)^2) equation? I thought I've seen it before but when I went searching again today I could only find it in snippets from you.

  • That formula doesn’t look familiar but possibly. Most of the formulas I post are either found online or just multiple formulas combined together and simplified.

  • That's what I generally assume with formulas I find online, but wanted to give you credit if it was yours. Either way Kudos for you!

  • Hello,

    I used winstreak's method, the video was very well done :) Thank you s much, it works exactly as I imagined. Much appreciated :)

    Thanks to everyone who also contributed, you are great people :)

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