ok this might be a little difficult to explain but here goes.
its for a 2D side scrolling shoot em up with a fake z axis ( like streets of rage)
basically ive got a like a laser cannon on tracks that shoots a constant beam of lightning every (x) number of seconds when fully charged.
the tracks them self's are the z axis position and the turret on top rotates towards the player in a constant beam when firing
my problem is i need a formula / function that calculates when the bean should stop (beam should not go below the y of the tracks) but move from infront of the player to behind on the same fake z axis ( y axis of tracks) unless told to.
in a nut shell i need a function that works out the longest length of a 90 degree triangle every tick while the cannon is firing.
no point in adding a capx as it would just be the laser cannon that can rotate the turret.
But i can if needed draw a diagram of what im looking for.
I know the maths to work it out but having trouble converting the maths into a function that works it out.
really hope that makes sense.