What's a good way to programmatically manage a cloneable entity?
Posted
by
bobobobo
on Game Development
See other posts from Game Development
or by bobobobo
Published on 2012-11-21T17:52:25Z
Indexed on
2012/11/21
23:12 UTC
Read the original article
Hit count: 340
c++
|instancing
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
selectedWeapon
member is looked at, and the correct instance of rocket is created (with some base parameters)
Or
- 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
© Game Development or respective owner