# How do I create a bullet movement with trajectory

Get help using Construct 2

### » Thu Jan 14, 2016 6:53 pm

I am trying to create the same concept from the link below in Construct2
http://gamemechanicexplorer.com/#bullets-5

I have found some examples on the forum but none is complete.
Three I am trying to accomplish here:
- Show trajectory
- Move through the trajectory
- Change bullet speed

Thanks,
B
130
S
51
G
25
Posts: 401
Reputation: 22,967

### » Thu Jan 14, 2016 8:53 pm

Here's one for the physics behavior:
how-do-i-ball-trajectory-prediction_p983623?#p983623

But you can do it without with simply:

global number gravity=1000
global number speed=200

global number step=0.1
global number vx=0
global number vy=0
global number x=0
global number y=0

every tick
--- dot: destroy
--- set x to cannon.x
--- set y to cannon.y
--- set vx to speed*cos(cannon.angle)
--- set vy to speed*sin(cannon.angle)

repeat 100 times
--- create dot at (x,y)
B
97
S
36
G
131
Posts: 5,520
Reputation: 83,478

### » Thu Jan 14, 2016 9:51 pm

@R0J0hound

You example seems to be very simple but I not sure where to add things to.
Here is my capx for your reference https://www.dropbox.com/s/19z4n8iocakmxsq/trajectory-movement.capx

Also, can I change where the bullet start the movement (x,y)?

thanks,
B
130
S
51
G
25
Posts: 401
Reputation: 22,967

### » Fri Jan 15, 2016 6:59 am

I can't open your capx atm, but the every tick event is where you set the starting X,y, and velocities. In what I typed about it uses a object called cannon's position and angle.
B
97
S
36
G
131
Posts: 5,520
Reputation: 83,478

### » Fri Jan 15, 2016 4:08 pm

Ok @R0J0hound. I few more questions.
1) The ball should have which behavior?
2) what triggers the ball to start moving?
B
130
S
51
G
25
Posts: 401
Reputation: 22,967

### » Sat Jan 16, 2016 6:38 am

1) the bullet behavior would work fine.

2) just set the bullet's speed angle of motion and gravity, but you could do whatever.
B
97
S
36
G
131
Posts: 5,520
Reputation: 83,478