Path: chuka.playstation.co.uk!news From: "Darren Jackson" Newsgroups: scee.yaroze.beginners Subject: Re: angles, angles Date: Mon, 23 Nov 1998 23:36:18 -0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 52 Message-ID: <73cs2m$no810@chuka.playstation.co.uk> 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> <36588BB6.65EC@manc.u-net.com> NNTP-Posting-Host: client4081.globalnet.co.uk X-Newsreader: Microsoft Outlook Express 4.72.3115.0 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 >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. > it is helping a bit, its slowly becoming more clear, but I still have a basic problem. Have you ever been in a position where no matter how many times you bang your head against a brick wall, the wall doesn't budge? I think I have a mental block at the minute! Changing the code as you suggested doesn't make any difference (note I used >>9 because >>12 didn't work, if I used >>11, then I get a slower sprite but lower resolution). I think I am missing something fairly basic here or maybe I am not thinking about it right. Going back to basics, my sprite has a x_speed and a y_speed. These speeds are added to x and y members of the GsSPRITE when up is pressed. To find the values of x_speed and y_speed when the sprite has been rotated to make the sprite go forward in the direction its pointing, I use trig functions, hence x_speed=sin(angle)*magnitude y_speed=-cos(angle)*magnitude. Since I want the sprite to go slowly, magnitude=1. This is where I get a block, because I cant see how I can move the sprite one pixel at a time when the angle is not 0,45,90,135 etc? If I was to move it say 8 pixels at a time, I can see how to get more resolution, but this is no good. Apologies if you are getting fed up with this (I know I am!) I know it will take just one little thing for me to understand then I will kick my self very hard as it all becomes clear! Darren