Say you have missiles or rockets that a player can fire.
What's a good way to programmatically manage the cloning of a base rocket, for example?
I can think of 2 ways to do it:
- Player has a currently selected weapon (which is an int)
- When player shoots, the
selectedWeaponmember is looked at, and the correct instance of rocket is created (with some base parameters)
- Player has a currently selected weapon (which is a pointer, to a "base instance" of the rocket object)
- When player shoots, the base instance rocket is cloned, transformed, and shot into the game world