At the moment I have some basic acceleration code for an asteroids style game. Here is what I have for accelerating forwards.
And here are the functions the above code calls.
The problem is that instead of the player being able to move along any angle, it seems as if the angle is being rounded into 4 directions. The directions are 45 degrees, 135 degrees, 225 degrees and 315 degrees (so can basically only go in a diamond shap)
Anyone got any ideas?
Thanks in advance.
Player(pnum)\SpeedX# = NewXValue#(Player(pnum)\SpeedX#, 100 * FL\SpeedFactor#,Player(pnum)\AngleZ#) Player(pnum)\SpeedY# = NewYValue#(Player(pnum)\SpeedY#, 100 * FL\SpeedFactor#,Player(pnum)\AngleZ#)
And here are the functions the above code calls.
Function NewXValue#(oldX#, amount#, Angle#) TempAngle# = Angle# cosine# = Cos#(TempAngle#) cosine# = Cosine# * amount# Newx# = oldx# + cosine# Return Newx# End Function Function NewYValue#(oldY#, amount#, Angle#) TempAngle# = Angle# sine# = Sin#(TempAngle#) sine# = sine# * amount# Newy# = (oldy# + sine#) Return Newy# End Function
The problem is that instead of the player being able to move along any angle, it seems as if the angle is being rounded into 4 directions. The directions are 45 degrees, 135 degrees, 225 degrees and 315 degrees (so can basically only go in a diamond shap)
Anyone got any ideas?
Thanks in advance.