Parabolic Canon Ball Movement
-
So far i made it so when im looking right and i press space i shoot a canonball which moves like a parabola, tho i dont know how to make it so when im turned left and i press space that it moves the same way, just to the left....
this is the code:
and this is the parabolic function im using:
And with my variables:
I added *0.5 because i didn't canon ball to land too far away from the ship
Here is the video on how the canon ball moves using this function :
https://streamable.com/4xpnxIf any1 could figure out a function which i could use for when my ship is turned left i'd really appreciate it... I tried adding and subtracting stuff from this function but nothing worked out as it should've.... So please if anyone knows any solution to it please help me out :(
-
Hi
Its not so nice with pictures for code as you cant cut and paste. or even scroll to see all of it.
Anyway,
the x()+moveByX seems to control the direction so
MoveByX += 0.1
could be
MoveByX += - 0.1 ( when direction == 3 )
to decrease the x ?the parabolic seems only to be used for the y decay.
-
@MongKong said in Parabolic Canon Ball Movement:
tried and it doesn't work :
try to output x values with QDebug and see why.