[CC] [SOLVED] Creating a bullet with a parabolic arc

This forum is currently in read-only mode.
  • The title says it all.

    To picture: think of say, the trajectory of a fountain. I'd like the bullet to rise up and fall in a parabolic arc.

    Which math expression would I use to achieve this affect? I would like to avoid using the Physics behavior + gravity or "cheating" with Platform behavior, because I would like the bullets to ignore solids.

    Or would I use Custom Movement, setting up a time of upward velocity and downward velocity, while adding a little horizontal acceleration? That seems a little messy, which is why I am asking if it can be done with a math expression.

    Thanks in advance for any help.

  • 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 the Bullet behavior?

    It includes built in gravity, just set the Gravity parameter, it adds the affect of gravity on the bullet, in pixels per second per second.

    Its what I used in Cannonball Bash.

    https://www.scirra.com/arcade/shooting-games/cannonball-bash-1373

  • For the math, give the sprite two variables:

    velocityX and velocityY

    Then make this event:

    Always:

    --- sprite: add 100*timedelta to veloctyY

    --- sprite: set x to sprite.x+sprite('velocityX')*timedelta

    --- sprite: set y to sprite.y+sprite('velocityY')*timedelta

    The 100 is the gravity which you can adjust.

  • Thanks R0J0 for the tip. I have it set up as you say in this picture

    I just have one question as far as tweaking.

    The event is recreated in this .cap:

    https://dl.dropboxusercontent.com/u/290 ... c_test.cap

    I would like to give the bullet a more vertical arc, instead of falling down from the origin point (e.g. I'd like: rise, then fall). I tried setting the vy to negative, with obvious (unwanted!) results.

    Would I need to set up some sort of dummy points and have the bullet arc between those points to get what I want?

  • I don't have CC installed on right now so I can't open your cap.

    To make it go up first you just need to set the vy to negative when you spawn the bullet.

  • Thanks for the information! Fiddling around with various -(vy) values I was able to essentially get what I wanted.

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