How do I Make Parabolic Projectile and Movement

0 favourites
  • 11 posts
From the Asset Store
Calculate parabolic trajectories and tween objects over them.
  • Hi guys... i was wondering if you could lend me some of you wisdom in the fiel of mathematics and C2

    im looking for a bullet that will travel in a parabolic way (like castlevania's skeletons)... and hit the player, but not ramdom, but with precision (see the picture attached) i can make a parabolic bullet but i cant do it that it will always fall where the players is... so if he does not moves it will hit him.

    how do you do it??? 0:

    another thing if its possible to implement this to make enemies jump in a parabolic trajectory and fall in the player... that would be awesome...

    thanks in advance, any help will be appreciated

  • Graphics looks really nice

    The bullet behaviour has gravity. Just try to play around with that I guess.

  • Here is a capx with a few different methods:

    /examples22/cannon.capx

    https://www.dropbox.com/s/f651hqzv53u23 ... .capx?dl=1

    The first method uses a fixed speed and finds an angle. The angle is NaN if there is no solution.

    The second uses a fixed angle and finds a speed. The angle is NaN if there is no solution.

    The third is like the second but the angle is always pointed above the target so there always is a solution.

    Finally the bullet behavior wasn't used since the path isn't accurate when using gravity.

  • Here is a capx with a few different methods:

    https://dl.dropboxusercontent.com/u/542 ... annon.capx

    The first method uses a fixed speed and finds an angle. The angle is NaN if there is no solution.

    The second uses a fixed angle and finds a speed. The angle is NaN if there is no solution.

    The third is like the second but the angle is always pointed above the target so there always is a solution.

    Finally the bullet behavior wasn't used since the path isn't accurate when using gravity.

    i will check it out =) thanks a lot...and report findings

    btw your plugins are awesome... and many of my game's features could not be possible wihtout you =) thanks

    you surely will appear in my game with other user that are so firendly and helpful XD

  • Awesome example, mod speed mode is so close to what i need as the flight time seems to remain the same no matter how far away i click from the cannon. Changing the angle (to Mouse.Y-400 rather than -200, for example) alters the flight time, is there a way i can have fixed flight time regardless of the angle? I'd like to have 3 projectiles that have different angle but same flight time so they all hit the target at the same time.

  • is it possible to combine this with Turret behavior ?

  • Alpro

    Having a fixed flight time and having a different launch angle isn't physically accurate since it requires each cannonball to have a different gravity.

    Do do a launch here are the formulas. "angle" is the launch angle and t is the flight time. You'll need to change event 5 to use ball.gravity instead of gravity in the equations.

    ball set vx to (x_target-x_start) /t

    ball set vy to ball.vx*tan(angle)

    ball set gravity to 2*(y_target-y_start-ball.vy*t)/t^2

    bear13

    Probably no, the turret behavior is for straight shots, but with some creativity you possibly could do something similar with events.

  • Can this be done without using gravity then? Like a formula to follow an arc from point A to point B, with a specific angle and flight time? There has to be a way...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Alpro

    It can be done by modifying the capx with the info from my last post, or you could setup a function to do a Quadratic Bezier Curve, which is like lerp but you can do this:

    http://en.wikipedia.org/wiki/B%C3%A9zie ... tic_curves

    and here's the math for it:

    http://en.wikipedia.org/wiki/B%C3%A9zie ... ier_curves

    The math doesn't look much simpler:

    https://dl.dropboxusercontent.com/u/542 ... /qarp.capx

    You can change up the path by changing xmid and ymid to another location.

  • Thanks, i will experiment with this.

  • I really needed this. thanks

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