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

For questions about using Classic.

### » Fri Aug 28, 2015 2:15 am

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.
Last edited by Emperor Ing on Mon Aug 31, 2015 11:02 pm, edited 1 time in total.
Check out my VGM on my soundcloud page!
Video-Game Music: E.C.2151
B
9
S
3
G
2
Posts: 194
Reputation: 1,713

### » Fri Aug 28, 2015 5:15 pm

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.
B
252
S
65
G
34
Posts: 907
Reputation: 41,515

### » Fri Aug 28, 2015 7:00 pm

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.
B
97
S
36
G
131
Posts: 5,514
Reputation: 83,466

### » Mon Aug 31, 2015 5:39 am

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?
Check out my VGM on my soundcloud page!
Video-Game Music: E.C.2151
B
9
S
3
G
2
Posts: 194
Reputation: 1,713

### » Mon Aug 31, 2015 6:22 pm

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.
B
97
S
36
G
131
Posts: 5,514
Reputation: 83,466

### » Mon Aug 31, 2015 11:01 pm

Thanks for the information! Fiddling around with various -(vy) values I was able to essentially get what I wanted.
Check out my VGM on my soundcloud page!
Video-Game Music: E.C.2151
B
9
S
3
G
2
Posts: 194
Reputation: 1,713

Return to Help & Support using Construct Classic

### Who is online

Users browsing this forum: No registered users and 0 guests