   Help implementing bullets in a shooter (J2ME)
  I kinda need help in devising an J2ME algorithm which allows a player to fire bullets from his sprite regardless of where the sprite is located on the screen as well as implement this for any NPC and boss sprite. In other words, create a reference point that follows the current location of the player sprite in which a bullet can originate from. But here's the catch: since my phone's API does not have a true GameCanvas class, it does not support transformations and reference pixels. How do I achieve this with these limitatons? Also, how would I be able to set the time in between shots? And no, I don't have a snippet at the moment, let's just say that I plan to implement this in a seperate bullet class that extends the sprite class, so that it can be used in my player sprite and NPC/boss class.[Edited by - thelegendofzaku on December 12, 2005 1:51:50 AM]
  You haven't provided enough information to get a good answer.  Tell us what you're programming this in, and even a snippet of some of your code if you can.  If you can make a moving sprite, i'm sure you can make a bullet   ;  The technique commonly used to detect where a bullet might hit when fired from an object is called raycasting. The process basically involves tracing a line outward from the barrel of the gun and finding the object that has the closest intersection with that line. There are a number of good articles out there that tell you how to go about implementing and eventually optimizing this.A class that implements transformations is actually not required for this (it just helps a bit when you actually need to transform an object). I suggest picking up a good Linear Algaebra book or muck around with the articles on GameDev regarding basic geometric manipulation.As a minor suggestion, once you've managed to craft this function that traces from one point to another in your world, you might want to make it even more abstract than just something that Player/NPC objects use. There are a huge number of tasks in sumilated worlds that require you to "find the closest thing intersecting this line".   