Path: chuka.playstation.co.uk!news From: "Rad" Newsgroups: scee.yaroze.programming.2d_graphics Subject: What do'you mean I have to brush up on me maths! Date: Tue, 22 Jun 1999 14:03:32 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 30 Message-ID: <7ko1jf$33u25@chuka.playstation.co.uk> NNTP-Posting-Host: vil-12.village.gre.ac.uk X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 At the moment I have an enemy ship which only fires forward but I want the bullet to travel in the direction of the player, but not follow the player. So the bullet uses the player's x and y position when it is first fired and continues traveling in that direction until it leaves the screen. I wrote some code ages ago based on Bresenham's algorithm that I might be able to use but to be honest I can't be arsed to find it, plus I'm not sure it will work for this. So any ideas on how I can do this? Thanks, Rad. rad@cyberdude.com http://www.netyaroze-europe.com/~radpsx p.s. another question: If I increment a variable every frame/program loop (i.e. counter++) and want to do something if counter reaches x then is it safe to do a test like this: if (counter == x) or is it better to do this: if (counter >= x) ? I take it the second 'if' performs two 'if' statements where as the first only performs one which makes the first one quicker? But is it safer? (i.e. to assume that counter will ALWAYS increment by one).