Path: chuka.playstation.co.uk!news From: James Shaughnessy Newsgroups: scee.yaroze.beginners Subject: Re: angles, angles Date: Sun, 22 Nov 1998 22:09:58 +0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 54 Message-ID: <36588BB6.65EC@manc.u-net.com> References: <72spa7$dvm12@chuka.playstation.co.uk> <72sr28$dvm13@chuka.playstation.co.uk> <3652971c.228584498@news.playstation.co.uk> <731up3$olq9@chuka.playstation.co.uk> <3654E715.74C8@manc.u-net.com> <739qi2$ekm13@chuka.playstation.co.uk> Reply-To: james@manc.u-net.com NNTP-Posting-Host: manc.u-net.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.0 (Win95; I) Darren Jackson wrote: > how may different paths are they between 0 and 90degrees? and how do There are 1024 finite directions between 0 and 90 degrees if you use SCBUILD 4096. That should be plenty enough for the vast majority of projects. Use of velocity vectors effectively increases this too. (which you are already using) So yes you are on the right track but you're making a classic error -- you are losing the 'resolution' by storing the tank's speed in its real (ie. non simulated floating point) form (by doing the >>9 in the wrong place). So, looking at the code you posted: > if (PAD & PADup } > { > tank1.x_speed=(SIN[tank1.sprite.rotate/360]>>9); > tank1.y_speed=-(COS[tank1.sprite.rotate/360]>>9); > MovePlayer(); > } > void MovePlayer() > { > tank1.sprite.x += tank1.x_speed; > tank1.sprite.y += tank1.y_speed; > } It should actually be: if (PAD & PADup } { tank1.x_speed = SIN[tank1.sprite.rotate/360]; tank1.y_speed = -COS[tank1.sprite.rotate/360]; MovePlayer(); } void MovePlayer() { tank1.sprite.x += tank1.x_speed>>12; // can use >>9 tank1.sprite.y += tank1.y_speed>>12; // or whatever } You should find that you can get the tank to go as slowly as you want. Bear in mind that the x_speed and y_speed velocity vectors are where the SCALING FUNCTION is (they are ALWAYS 4096 times their floating point size) -- so only when you *refer* to them do you use the >>12 part. Hope this helps, Jim -- ----------------------------------------- James Shaughnessy james@manc.u-net.com http://www.netyaroze-europe.com/~shaughnj -----------------------------------------