Yeah, I did that straight away Remnant, and just add the X and Y of that (found once whenever you have a new destination) to the x and y of my ball, so it seems pretty efficient . However, moving on a bit, what is the best way to perform prediction on a target? That is, if I want the ''ball'' to move towards a ''box'', and the box is moving x and y per loop (speeds which we know), what is the best way to ensure that the ball will cross the box, going in a straight line? Testing it out with no y movement, and a constant x movement (of the box, that is) I tried dividing the y distance between the box and ball by the y movement of the ball (distance/speed I think ) and multiplying it by the boxes movement (x), then adding that to the x distance... which in theory works... but sometimes fails... I tried it out again with the y implemented as well, and accounted for the new distances by recalculating the gradient where necessary, but still, about 5 times in 10 it fails...
I know that''s not very clear, so if necessary i''ll have to adapt some code (make it readable for a start ) and post it later...
Any formulae or wotnot are appreciated
Cheers all,
Nick - Head Designer, Llamasoft.net
--
Visit our website...
Llamasoft.net
Games, goodies and ingenuity
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement