Arena Shooter tutorial
Step 4: Bullets
Bullets are created dynamically by pressing space, they fly (implement MovementDecorator) until they crash to the wall of Arena (implement CrashDecorator). For generating bullets, we use BulletFactory (a design pattern), which needs a single parameter: the gun which launched the bullet (it is the Rocket). The bullet copies the angle from the gun in the moment of launch, and then moves until crash to the wall.
There should be a dedicated object implementing Pool pattern which takes responsibility for bullets behavior in the game and also implementing Mediator pattern to inform other object that they were hit. But since the gun needs the bullet information (it can shoot only one per time) and no other object interact with the bullet, the gun itself can be the pool and mediator is not needed. Back to the game.