kenny-designs / MechEngine

The goal of this project is to create an RTS-styled game engine. Inspired by works such as Starcraft, Warcraft, Company of Heroes, etc...
0 stars 0 forks source link

Spawning Units #12

Open kenny-designs opened 8 years ago

kenny-designs commented 8 years ago

In order to create a new unit the coder has to go through several steps over and over again. Take the following for example:

zombieUnit.setUnit("zombieAnim.x", "Zombie", 0.02f, 0.375f);
zombieUnit.LoadXFile("zombieAnim.x");
allUnits.push_back(&zombieUnit);
zombieUnit.SetCurrentAnimation(zombieUnit.GetCurrentAnimation() + 2);

zombieUnit2.setUnit("zombieAnim.x", "Zombie2", 0.02f, 0.375f);
zombieUnit2.LoadXFile("zombieAnim.x");
zombieUnit2.endPosition.x = 1.0f;
allUnits.push_back(&zombieUnit2);
zombieUnit2.SetCurrentAnimation(zombieUnit2.GetCurrentAnimation() + 2);

zombieUnit3.setUnit("zombieAnim.x", "Zombie3", 0.02f, 0.375f);
zombieUnit3.LoadXFile("zombieAnim.x");
zombieUnit3.endPosition.x = 4.0f;
allUnits.push_back(&zombieUnit3);
zombieUnit3.SetCurrentAnimation(zombieUnit3.GetCurrentAnimation() + 2);

This all must be done to spawn three zombies. That is far too much work. Create a .h and .cpp file that will act as a cookie cutter to spawn in pre-created unit types such as zombies, marines, orks, etc...