Path: chuka.playstation.co.uk!news From: Philip Gooch Newsgroups: scee.yaroze.programming.2d_graphics Subject: Re: 2 Questions - Same Game Date: Wed, 21 Oct 1998 19:26:29 +0100 Organization: philg@nospam.easynet.co.uk Lines: 35 Message-ID: <362E2752.C32CA5AB@nospam.easynet.co.uk> References: <70f9cd$s3k10@chuka.playstation.co.uk> <362CAF35.50EF7FDA@easynet.co.uk> Reply-To: philg@nospam.easynet.co.uk NNTP-Posting-Host: philg.easynet.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854"; x-mac-creator="4D4F5353" Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.04 (Macintosh; I; PPC) Phil Gooch wrote: > > > Then modularise the angle to 360 and make positive: > > object.rotAngle = (360 + (object.rotAngle % 360)) > > Use this value to rotate your sprite: > > object.sprite.rotate = object.rotAngle*ONE > Whoops, there's a couple of errors here: this should be: object.rotAngle = object.rotAngle % 360; // modularise object.sprite.rotate = object.rotAngle*ONE; // rotate sprite then do object.directionX = COS[(360 + object.rotAngle)%360]; // ensures array index is between 0 and 360 object.directionY = SIN[(360 + object.rotAngle)%360]; Phil