How do I simulate the arc of a bullet?

0 favourites
  • 9 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • I want to calculate a smooth curve for a sprite following my hidden bulle to simulate gravity in an isometric view.

    I can manage make a linear decline based on the distance travelled, but i want a smooth curve similar to what I'm trying to illustrate in this image. Is it possible with math/expressions to get that kind of decline? and what expressions calculations should I use?

    What I'm trying to achieve is to adjust the Y position (distance between the bullet and the sprite) following the bullet in a more curved fashion, rather than a linear decline (showed in red)

  • Have you tried to use the Physics behavior?

    I'm not quite sure because I never used it, but I think it might be just what you need

  • To clarify.

    Each bullet has 2 instance variables which i use to calulate the decline.

    "bullet.traveldistance" = how many pixels the bullet will travel before it's destroyed.

    "bullet.offset" = They Y offset of of the sprite following the bullet, based on the distances between the player and the traveldistance instance variable.

    When the bullet is created the offset is '-40' ... when the bullet reaches the endpoint the offset value is '0'

    So somewhere inbetween here i need to do some adjustments to the offset in order to get an arc.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you tried to use the Physics behavior?

    I'm not quite sure because I never used it, but I think it might be just what you need

    I've tried it but it doesn't really work in this case. I'm basically just looking for a way to calculate an arc.

  • I googled a bit but I'm not a math genius but i think I have to add another value.. to add (Sagitta) af an arch to the 'offset' value.

    So now comes the REAL question. How do i write this formula in construct?

  • s = ut + at^2/2 in 2 axes.

    I note this is isometric. I would be inclined to calculate it in real world coordinates and then convert to isometric ones.

  • You might want to look at the Sine behavior.

    Here's how I'd do it. Cheap and easy !

  • You might want to look at the Sine behavior.

    Here's how I'd do it. Cheap and easy !

    nice example. thanks! Thats not a bad solution!

    I managed to make it using the sin expression instead.

  • I made this example a while ago - it's simple and produces a reasonable effect if you know where you want your bullet (arrow in this example) to land - in 2d or isometric.

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