void addCannonProjectiles() { for(int i = 0; i < 8; i++) { Projectile * p = new Projectile(false, projectileMesh, CANNON_PROJECTILE_SCALE); parts.push_back(p->getPart()); p->getPart()->setMaterialGreenProjectile(); cannonProjectiles.push_back(p); } }
Ship * addShip(bool fullSize) { Ship * ship = new Ship(fullSize, ID_TIE_FIGHTER_IMG, sphereMesh, shipWingConnector, shipWing, textureMapSphere1); // projectile Projectile * p = new Projectile(true, projectileMesh, WALKER_PROJECTILE_SCALE); p->getPart()->setMaterialRedProjectile(); ship->setProjectile(p); shipsProjectiles.push_back(p); parts.push_back(p->getPart()); ships.push_back(ship); parts.push_back(ship->getBody()); return ship; }
Walker * addWalker() { int numWalkers = walkers.size(); int xOffsetMultiplier = (numWalkers % 2 == 0) ? (1*(numWalkers+1)) : (-1*(numWalkers)); xOffsetMultiplier *= WALKER_SPREAD; Cannon * walkerGun = new Cannon(cannonBodyMesh, cannonSightMesh, false); Walker * walker = new Walker(ID_WALKER, ID_METAL, walkerHeadMesh, cylMesh, cubeMesh, textureMapCubeWalkerHead, textureMapCylinder, walkerGun); GLfloat xStart = xOffsetMultiplier + WALKER_START_X_OFF; GLfloat yStart = WALKER_BODY_HEIGHT; GLfloat zStart = WALKER_START_Z; walker->setStartPosition(xStart, yStart, zStart); walker->getBody()->setTransformationValueWithId(ID_BODY_TRANSLATION, xStart, yStart, zStart, 0); // projectile for the walker Projectile * p = new Projectile(true, projectileMesh, WALKER_PROJECTILE_SCALE); p->getPart()->setMaterialRedProjectile(); walker->setProjectile(p); walkerProjectiles.push_back(p); parts.push_back(p->getPart()); // walkers.push_back(walker); parts.push_back(walker->getBody()); walker->start(); return walker; }