caleb1997 wrote:
Kerm: Yes, I know algebra.
And for the arc, I know how to calculate that. My equation of choice is:
2v^2*sin(theta)*cos(theta))/g
g=9.8 m/s^2
v= initial velocity
y=starting height (will be 2)
theta= angle relative to the ground, which will be completely horizontal.
V will depend on how far back you draw the slingshot. Or would it be 0?
The difficult part is coding in something that will make the bird fall down, and whatever it hit to move/die.
Would anyone mind helping me write a algorithm that will Pxl-Test in front of the point (that will be the bird, for now) so it can be checked for collision?
And for the arc, I know how to calculate that. My equation of choice is:
2v^2*sin(theta)*cos(theta))/g
g=9.8 m/s^2
v= initial velocity
y=starting height (will be 2)
theta= angle relative to the ground, which will be completely horizontal.
V will depend on how far back you draw the slingshot. Or would it be 0?
The difficult part is coding in something that will make the bird fall down, and whatever it hit to move/die.
Would anyone mind helping me write a algorithm that will Pxl-Test in front of the point (that will be the bird, for now) so it can be checked for collision?
V would definitely not be 0, because then the equation would end up always being = to 0. I don't see why the angle relative to the ground would always have to be horizontal, then you would never have a nice arc, but rather just something that looks like -X^X. If you want to use a kinematic formula to find where the projectile will end up (on a tower for example) I'd recommend using P=(Vsin(theta)^2)/2g, where P is the range, g is the gravity, theta is the angle relative to the x axis, and V is the initial velocity. Maybe you would also want to reduce the 9.8 to something a little smaller simply because in the real game, the birds almost seem to be on the moon haha.