How do I make an object travel making a parable.

0 favourites
From the Asset Store
Make your own platformer for both the web and mobile easy with this Santas Platformer Template, FULLY DOCUMENTED
  • I'm using turret behavior, when On shoot triggers, I'm spawning a bullet.

    How do I make this object with bullet behavior travel making a parable instead of going straight to the target?? Like an arrow.

  • If you use the Set Angle it should do the trick.

  • use set Angle and try to add physic behavior to your projectile

  • emoaeden

    Set angle have nothing to do with it, buddy. :/ It just don't do what I want. I need to go from a to b in a parable instead of a straight line.


    Physics behavior for this is a waste for memory and cpu. Totally innefficient and not necessary :/

  • The bullet behaviour already has gravity - just use that to make the bullet describe a parabolic arc. It's as simple as that for a side view game; if your game is isometric then the maths will be more involved and you'll have to vary bullet speed and apparent gravity according to shoot angle / player heading.

    Edit to add: If you want to calculate the shot angle so the bullet describes a parabola and then hits the intended target, you'll need to solve the equations of motion for x and y velocities - x velocity constant, y velocity accelerated by gravity and overall distance traveled the delta y from turret to target.

    For x: s = ut

    For y: s = ut + 0.5at^2

    Time traveled for both is the same... I'm using my phone now but if this is what your after I'll try and put together an example later.

  • Colludium

    It's not a platform game. It's a tower defense like kingdom rush. The example of what I need is right here (

    ... And I'm retarded regarding to math. Especially when it's about movement calculation :/

  • Here you go... Click to mark a target position and the arrows will fly to hit each one precisely. I enjoyed putting this together .

    URL deleted. See later post on page 2 for update.

  • Here you go... Click to mark a target position and the arrows will fly to hit each one precisely. I enjoyed putting this together .

    simple parabolic arrow capx

    That's reaaaallly cool man. Thank you very much. Could you explain a little bit the math you did? I'm just terrible doing math.

  • Sure. I used one equation of motion (variables: u is starting velocity, s is displacement, a is acceleration and t is time taken):

    s = ut + 0.5 at^2

    By setting the arrow time of flight to a constant and known value, it becomes easy to figure out the missing variables. This does not necessarily reflect reality, but it's more than good enough for a game. For movement in the x direction, I chose to make the movement linear in all screen directions ie constant x velocity and zero acceleration. Thus the equation becomes u = s / t.

    For movement in the y direction (ie vertical) I had to consider gravity acceleration. The variable s is the difference between start and end y values. Starting velocity is then figured by manipulating the equation to give u = (s - 0.5 at^2 ) / t. All of the variables s, a and t are known, so the starting vertical velocity can be figured out. That leaves moving the arrows, which is done every tick by giving each arrow object an object variable Y_Vel (for y velocity)... et voila!

  • Colludium

    It's a bit more clear ^^. Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Could you please reupload this file again? I have the same problem as OP.

  • davy421

    Could you please reupload this file again? I have the same problem as OP.

    You need to tag the person in question or they will never know you are asking them. In this case, it looks like you want Colludium to re-upload the file.

  • Hi davy421, I'll see if I can find the file for you. However, I fear that some over-zealous folder clearing on a new computer might have sent it to oblivion... In which case give me a while and I'll create a new one.

  • Colludium I'm willing to wait, thank you for responding.

  • , I had deleted the original demo, so try this capx for an alternative method. I actually think that this is better as it gives you the option of having a shadow as well .

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