Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: "John Emmer" Newsgroups: scea.yaroze.programming.2d_graphics Subject: Re: Algorithm to orbit? Date: 3 Aug 1997 20:28:52 GMT Organization: Justice Center Lines: 43 Message-ID: <01bca043$beb64300$8bf135ce@jjustice.iquest.net> References: <01bca03a$5c9d6ee0$8bf135ce@jjustice.iquest.net> <33E4E1EE.7CE0791A@ix.netcom.com> Reply-To: "John Emmer" NNTP-Posting-Host: and-003-11.iquest.net X-Newsreader: Microsoft Internet News 4.70.1161 Manny Najera wrote in article <33E4E1EE.7CE0791A@ix.netcom.com>... > I don't think you'd need anything as complex as matrix math to do > something like this. > > All you need is two sprites of the same size. One sprite is your tank, > and the other is the turrent. Rotate the turrent, and draw it under or > over the tank. You can then draw another sprite above all of them to > make the turrent look like it's built into the tank. As long as both > the turrent sprite and the tank are the same size, the turrent will > always appear to rotate around the center. > If I understand you correctly, I thought of doing that way, but since I want the tank and turret to be able to rotate independently I don't think I can just stick two sprites of the same size on top of each other. The turret is located towards the back of the tank, so the point around which the turret rotates _on its own_ is not the same as the center of the tank. This also means that, when the tank rotates, I can't just rotate the turret at the same speed without moving it, because the point on the tank to which the turret is 'attached' moves around in a circle as the tank rotates. Does that make sense? I suppose the easiest solution would be to just redraw the tank so that the turret would attach in the middle. (My sprites are quite simple, so a redraw would be easy.) I just think the tank looks cooler with the turret attached nearer to the rear, and it makes it very easy to tell what is the front of the tank. Wait! Maybe I misunderstood you - or maybe I just figured something out - what I need to do is change the center of rotation for the turret sprite when the tank rotates. That is, when the turret is rotating with the tank, I rotate it around the center of the tank, and when it rotates on its own, I use its normal center of rotation. Doh! Well, sorry for thinking 'out loud' as it were. I'll go give this a try. Thanks for the suggestion! -- John Emmer Video Game Enthusiast, Philosopher, Fledgling Programmer jjustice@cs.bsu.edu jjustice@iquest.net jpemmer@bsuvc.bsu.edu Vectrex; 7800, Supercharger, Lynx, Jaguar; NES, SNES, Virtual Boy; Turbo Duo & Express; SG, SGCD, 32X, Saturn; 3DO; PlayStation, Yaroze; C64, A600, A1200, P100; Arcade Centipede, Spy Hunter, Neo-Geo; BA, MA, ABD