   Various game coding questions...
  1. If I'm creating a game where a character/whatever fires a bullet/laser/whatever what is the most usual way to implement that?Should you create a Bullet class with the attributes of a Bullet and then an array of Bullet objects that can hold the maximum amount of Bullets you want to be able to exist at any one time? And then have it use Bullet[0], then [1] etc.Or another way to put it: Let's say you're making a top-down shooter. How would you implement a system where you have Power Ups that spawn randomly whenever an enemy is killed? For simplicity's sake, let's say there's just one kind of Power Up. I know how to put an object somewhere and all, but in this case you'd be creating multiple instances of a certain kind of object and the amount of them spawned all depends on what happens when the game is played.Sorry if that was confusing... I just need some clarification on this whole issue.2. In a game like Pong or Breakout, do you need separate collision detection functions for detecting collisions with the X and Y axes? Or is there some easier method out of curiosity? Obviously, when a ball collides with the bottom of a block, it should act differently than when it hits the side.3. For neatness, should collision detection be in its own .cpp file or would that be messy? It'd need to have access to everything that it's going to check collision for which would mean a lot of "friend" keywords. Meh, I'm just nitpicking here I suppose.   
  Hi, these are my answers. I'm not an expert but I've done top down shooters and pong.1) I did this in a top down RTS game. I created a "projectile" class, and gave it flags for how it moves, a direction vector, speed etc. I then used a linked list which I scanned through on each frame. Collision detection, drawing and updating was all done by scanning through the linked list. Vector maths was very useful here. A laser was a projectile like any other, except that it didn't travel; It had a speed of 0, and its length was always the distance between the firer and the target.2) I did two player pong years ago in visual basic. I created a paddle class and a ball class. I then wrote a library of functions to test balls vs paddles, balls vs blocks, etc. For the collision detection system, I had one function which tested both x and y collisions between balls and blocks. I could give you the psudocode for this function if you wish.3) Effectively, yes. I currently have a collision system in development. It is in a separate cpp file with prototypes in the header.I'll give you a few specific examples. My characters are md2 models, made of triangles, and they are surrounded by a cylinder. To test their collision against each other I use the function cylinder_vs_cylinder.Bullets are actually "line segments". To test a bullet against a character, I first test if it hit the cylinder using the function line_segment_vs_cylinder. If so, I then test it against the polygons of the character using the function line_segment_vs_polygon.;  1) You seem to have a pretty good grasp on the bullet concept (even if you think you don't).Essentially, when an event triggers where you want to add a bullet to the world, you'll create the bullet, whether it be using some sort of projectile factory, or just by manually creating it, and add it to some list of live bullets. The implementation for the list doesn't matter. It could be a linked list, a vector, a simple array, whatever. The important part is that you'd iterate over this list every frame updating the bullets (testing for collisions and whether the bullet is dead) and then iterate over them to draw each.It's usually a good idea to limit the number of bullets to a finite number (even if it's high and it's not likely you'll ever max it out), at least if you're developing for a closed system. It's not as important for PC, but you should avoid dynamic allocation in gameplay if at all possible.I think you already know what to do for your bullets, hopefully this reassures you a bit though.2) For a game like pong, you could do all your collision detection and handling in one function. You really just need to find the intersection point on the block, adjust the ball so that it isn't inside the block anymore, and then deal with the collision (you know the angle of incidence for the collision (it's just the angle between the ball's movement vector and the collision line's normal), so you can use that to get the reflection angle (or to go even simpler in 2D, assuming you don't have any diagonal blocks, you can just negate the appropriate movement vector coordinate)3) If possible I'd try to centralize collision. You don't necessarily need a cpp JUST for collision, but try to group it with related things. For a simple game like pong this is usually less relevant as the code can still be simple even when having something like a "DidCollide" method in the ball class (or the collideable surfaces). Pong and breakout do tend to do special case handling (i.e. the top of the paddles in Pong, sides of the paddle in breakout)   