Get help using Construct 2

### » Fri Feb 06, 2015 8:50 pm

Ok so i want my player to throw projectile that will arc and reach a certain mark , but i want it to change its speed, angle, and gravity according to how far it is from the mark that i chose.

i tried using the distance formula inorder to optimize it, but i faced some problems.

1) the projectile's speed is fast then slower as it is near the mark then faster again as it gets further from the mark, i dont want that, i want it to simply curve while getting slower.

2) since the projectile curves i needed it to have an angle that is higher than the one facing the mark however, at shorter distances it didn't need to be as much higher from the mark as in longer distances, i wasn't able to optimize it perfectly inorder to land o the mark.
Banned User
B
7
S
1
Posts: 57
Reputation: 555

### » Fri Feb 06, 2015 8:56 pm

IGamesProduction try this tutorial

https://www.scirra.com/tutorials/1157/p ... ng-physics
B
210
S
28
G
14
Posts: 1,865
Reputation: 36,759

### » Sat Feb 07, 2015 6:18 am

the tutorial doesn't help, it doesn't change power or angle automatically based on a certain X_mark
Banned User
B
7
S
1
Posts: 57
Reputation: 555

### » Sat Feb 07, 2015 6:30 am

You definitely need 1 variable each for those parameters (bullet behavior I assume). As for the values of those variables, probably need some math guys to solve your problem.
B
16
S
7
Posts: 301
Reputation: 2,686

### » Sun Mar 22, 2015 10:01 am

yeah... thanks for your help anyways. i started trying to do some math myself.. it worked great on some distances and horrible on others ... i couldn't do exactly what i wanted. so i deleted the idea..
Banned User
B
7
S
1
Posts: 57
Reputation: 555

### » Sun Mar 22, 2015 11:31 am

There are multiple trajectory angles and launch velocities that can be given to a projectile to get it to land in a certain position. If you make the velocity a constant then you can solve for the angle, if you make the launch angle constant then you can solve for the velocity.

Physiscs Stack Exchange gives the answer - you need to solve two simultaneous equations, one for a constant velocity movement in the x direction and one for the gravity influenced up and down motion in the y direction (solve by assuming the time for each movement is the same). If you have two variables (angle and velocity) then you cannot solve it. If the start and end points are at different y values then y (or, rather, delta y) is not zero - the equation will still work.

If you apply your answer to the physics behavior then these equations do not account for linear damping, so they will make inaccurate predictions if you have linear damping set to above zero.
B
62
S
15
G
56
Posts: 2,138
Reputation: 36,348

### » Mon Mar 23, 2015 3:15 pm

i will try it thanks alot..
Banned User
B
7
S
1
Posts: 57
Reputation: 555