Wall* Wall::create(int id) { Wall *pRet = new Wall(id); if (pRet && pRet->init()) { pRet->autorelease(); return pRet; } else { delete pRet; pRet = NULL; return NULL; } }
Wall* Wall::create(ValueMap& model) { Wall *pRet = new Wall(model); if (pRet && pRet->init()) { pRet->autorelease(); return pRet; } else { delete pRet; pRet = NULL; return NULL; } }
Wall* Wall::create(const Size& size,const PhysicsMaterial& pm ) { Wall* wall = new (std::nothrow) Wall; if (wall && wall->init()) { wall->initBody(size,pm); wall->autorelease(); return wall; } else { CC_SAFE_DELETE(wall); return nullptr; } }
void ColoredCubeApp::initApp() { D3DApp::initApp(); #pragma region Base object initialization mBox.init(md3dDevice, 1.0f, WHITE); tealBox.init(md3dDevice, 1.0f, colorNS::TEAL); brick.init(md3dDevice, 1.0f, DARKBROWN); camBox.init(md3dDevice, 1.0f, BLACK); bulletBox.init(md3dDevice, 0.5f, BEACH_SAND); eBulletBox.init(md3dDevice, 0.5f, RED); maroonBox.init(md3dDevice, 10000, colorNS::MAROON); //redBox.init(md3dDevice, 0.00001f, RED); yellowGreenBox.init(md3dDevice, 1.f, LIGHT_YELLOW_GREEN); goldBox.init(md3dDevice, 1.0f, YELLOW); blueBox.init(md3dDevice, 2.0f, BLUE); rLine.init(md3dDevice, 10.0f, RED); bLine.init(md3dDevice, 10.0f, BLACK); gLine.init(md3dDevice, 10.0f, GREEN); xLine.init(&rLine, Vector3(0,0,0), 5); xLine.setPosition(Vector3(0,0,0)); yLine.init(&bLine, Vector3(0,0,0), 5); yLine.setPosition(Vector3(0,0,0)); yLine.setRotationZ(ToRadian(90)); zLine.init(&gLine, Vector3(0,0,0), 5); zLine.setPosition(Vector3(0,0,0)); zLine.setRotationY(ToRadian(90)); for (int i = 0; i < gameNS::NUM_BULLETS; i++) { pBullets.push_back(new Bullet()); pBullets[i]->init(&bulletBox, 2.0f, Vector3(0,0,0), Vector3(0,0,0), 0, 1); } for(int j=0; j<gameNS::NUM_CAMS; j++){ for (int i = 0; i < gameNS::NUM_BULLETS; i++) { enBullets[j].push_back(new Bullet()); enBullets[j][i]->init(&eBulletBox, 2.0f, Vector3(0,0,0), Vector3(0,0,0), 0, 1); } enemyTimer[j]= 0; } for (int i = 0; i < gameNS::NUM_RAGE_PICKUPS; i++) { ragePickups.push_back(GameObject()); } ragePickups[0].init(&tealBox, 2.0f, Vector3(-35,0,95), Vector3(0,0,0),0,1); ragePickups[1].init(&tealBox, 2.0f, Vector3(6,0,-80), Vector3(0,0,0),0,1); ragePickups[2].init(&tealBox, 2.0f, Vector3(-84,0,-56), Vector3(0,0,0),0,1); ragePickups[3].init(&tealBox, 2.0f, Vector3(10,0,80), Vector3(0,0,0),0,1); //floor.init(&yellowGreenBox, sqrt(2.0), Vector3(-5,-0.02,-5), Vector3(0,0,0), 0, 1); floor.init(&yellowGreenBox, 2.0f, Vector3(0,-1.5f,0), 1.0f, 100, 0.01, 100); player.init(&mBox, pBullets, sqrt(2.0f), Vector3(-90,0,85), Vector3(0,0,0), 0, 1); superLowFloorOffInTheDistanceUnderTheScene.init(&maroonBox, 2.0f, Vector3(0,-10.0f,0), Vector3(0,0,0), 0, 100000); // geom, rad, position, sc, w, h, d walls[0].init(&brick, 2.0f, Vector3(0, 0, 100), 1, 100, 10, 1); walls[1].init(&brick, 2.0f, Vector3(0, 0, -100),1, 100, 10, 1); walls[2].init(&brick, 2.0f, Vector3(100, 0, 0), 1, 1, 10, 100); walls[3].init(&brick, 2.0f, Vector3(-100, 0, 0),1, 1, 2, 100); walls[4].init(&brick, 2.0f, Vector3(-80,0,75), 1, 1, 2, 25); walls[5].init(&brick, 2.0f, Vector3(-80,0,25), 1, 20, 2, 1); walls[6].init(&brick, 2.0f, Vector3(-53.5,0,0), 1, 46.5,2, 1); walls[7].init(&brick, 2.0f, Vector3(-30,0, 25), 1, 1, 2, 25); walls[8].init(&brick, 2.0f, Vector3(-10,0, 50), 1, 10, 2, 1); walls[9].init(&brick, 2.0f, Vector3(0,0, 74), 1, 1, 2, 26); walls[10].init(&brick, 2.0f, Vector3(-5,0, 12), 1, 25, 2, 1); walls[11].init(&brick, 2.0f, Vector3(28.5,0, 0),1,21.5,2, 1); walls[12].init(&brick, 2.0f, Vector3(0.5,0, -37), 1, 1, 2, 37); walls[13].init(&brick, 2.0f, Vector3(20,0, 40), 1, 1, 2, 40); walls[14].init(&brick, 2.0f, Vector3(50,0, 80), 1, 30, 2, 1); walls[15].init(&brick, 2.0f, Vector3(75,0, 60), 1, 25, 2, 1); walls[16].init(&brick, 2.0f, Vector3(50,0, 40), 1, 30, 2, 1); walls[17].init(&brick, 2.0f, Vector3(75,0, 20), 1, 25, 2, 1); walls[18].init(&brick, 2.0f, Vector3(50,0, 10), 1, 30, 2, 1); walls[19].init(&brick, 2.0f, Vector3(80,0, 0), 1, 20, 2, 1); walls[20].init(&brick, 2.0f, Vector3(48.5,0, -30), 1, 1, 2, 30); walls[21].init(&brick, 2.0f, Vector3(60,0, -22.5), 1, 1, 2, 23); walls[22].init(&brick, 2.0f, Vector3(60, 0, -60), 1, 11.5,2, 1); walls[23].init(&brick, 2.0f, Vector3(-15, 0, -75), 1, 1, 2, 25); walls[24].init(&brick, 2.0f, Vector3(-40, 0, -50), 1, 40, 2, 1); walls[25].init(&brick, 2.0f, Vector3(-30, 0, -35), 1, 20, 2, 1); walls[26].init(&brick, 2.0f, Vector3(-30, 0, -15), 1, 20, 2, 1); walls[27].init(&brick, 2.0f, Vector3(-30, 0, -8), 1, 1, 2, 8); walls[28].init(&brick, 2.0f, Vector3(-30, 0, -42), 1, 1, 2, 8); walls[29].init(&brick, 2.0f, Vector3(-60, 0, -31), 1, 1, 2, 18); walls[30].init(&brick, 2.0f, Vector3(-70, 0, -31), 1, 1, 2, 18); walls[31].init(&brick, 2.0f, Vector3(-79, 0, -30), 1, 1, 2, 19); walls[32].init(&brick, 2.0f, Vector3(-79, 0, -85), 1, 1, 2, 15); walls[33].init(&brick, 2.0f, Vector3(-95, 0, -70), 1, 5, 2, 1); walls[34].init(&brick, 2.0f, Vector3(-95, 0, -30), 1, 5, 2, 1); walls[35].init(&brick, 2.0f, Vector3(80, 0, -25), 1, 1, 2, 25); walls[36].init(&brick, 2.0f, Vector3(48.5, 0, -70), 1, 1, 2, 15); walls[37].init(&brick, 2.0f, Vector3(29.5, 0, -85), 1, 20, 2, 1); walls[38].init(&brick, 2.0f, Vector3(-50, 0, 49), 1, 20, 2, 1); walls[39].init(&brick, 2.0f, Vector3(-50, 0, 70), 1, 20, 2, 1); walls[40].init(&brick, 2.0f, Vector3(-30, 0, 70), 1, 1, 2, 20); #pragma endregion //for(int i=0; i<gameNS::NUM_CAMS; i++) //{ // enBullet[i].init(&eBulletBox, 2.0f, Vector3(0,0,0), Vector3(0,0,0), bulletNS::SPEED, 1); // //} #pragma region Camera Placement enemyCam[0].init(&camBox, enBullets[0], 2.0f, Vector3(-90,0,15), Vector3(0,0,0), 0, 0, 1); enemyCam[1].init(&camBox, enBullets[1], 2.0f, Vector3(-35,0,5), Vector3(0,0,0), 0, 0, 1); enemyCam[2].init(&camBox, enBullets[2], 2.0f, Vector3(-35,0,45), Vector3(0,0,0), 0, 0, 1); enemyCam[3].init(&camBox, enBullets[3], 2.0f, Vector3(-35,0,60), Vector3(0,0,0), 0, 0, 1); enemyCam[4].init(&camBox, enBullets[4], 2.0f, Vector3(-75,0,60), Vector3(0,0,0), 0, 0, 1); enemyCam[5].init(&camBox, enBullets[5], 2.0f, Vector3(-35,0,75), Vector3(0,0,0), 0, 0, 1); enemyCam[6].init(&camBox, enBullets[6], 2.0f, Vector3(-75,0,95), Vector3(0,0,0), 0, 0, 1); enemyCam[7].init(&camBox, enBullets[7], 2.0f, Vector3(-5,0,95), Vector3(0,0,0), 0, 0, 1); enemyCam[8].init(&camBox, enBullets[8], 2.0f, Vector3(-5,0,55), Vector3(0,0,0), 0, 0, 1); enemyCam[9].init(&camBox, enBullets[9], 2.0f, Vector3(-25,0,75), Vector3(0,0,0), 0, 0, 1); enemyCam[10].init(&camBox, enBullets[10], 2.0f, Vector3(15,0,16), Vector3(0,0,0), 0, 0, 1); enemyCam[11].init(&camBox, enBullets[11], 2.0f, Vector3(-25,0,16), Vector3(0,0,0), 0, 0, 1); enemyCam[12].init(&camBox, enBullets[12], 2.0f, Vector3(0,0,45), Vector3(0,0,0), 0, 0, 1); enemyCam[13].init(&camBox, enBullets[13], 2.0f, Vector3(10,0,75), Vector3(0,0,0), 0, 0, 1); enemyCam[14].init(&camBox, enBullets[14], 2.0f, Vector3(30,0,90), Vector3(0,0,0), 0, 0, 1); enemyCam[15].init(&camBox, enBullets[15], 2.0f, Vector3(60,0,90), Vector3(0,0,0), 0, 0, 1); enemyCam[16].init(&camBox, enBullets[16], 2.0f, Vector3(90,0,90), Vector3(0,0,0), 0, 0, 1); enemyCam[17].init(&camBox, enBullets[17], 2.0f, Vector3(30,0,70), Vector3(0,0,0), 0, 0, 1); enemyCam[18].init(&camBox, enBullets[18], 2.0f, Vector3(60,0,70), Vector3(0,0,0), 0, 0, 1); enemyCam[19].init(&camBox, enBullets[19], 2.0f, Vector3(90,0,70), Vector3(0,0,0), 0, 0, 1); enemyCam[20].init(&camBox, enBullets[20], 2.0f, Vector3(30,0,50), Vector3(0,0,0), 0, 0, 1); enemyCam[21].init(&camBox, enBullets[21], 2.0f, Vector3(60,0,50), Vector3(0,0,0), 0, 0, 1); enemyCam[22].init(&camBox, enBullets[22], 2.0f, Vector3(90,0,50), Vector3(0,0,0), 0, 0, 1); enemyCam[23].init(&camBox, enBullets[23], 2.0f, Vector3(45,0,60), Vector3(0,0,0), 0, 0, 1); enemyCam[24].init(&camBox, enBullets[24], 2.0f, Vector3(30,0,30), Vector3(0,0,0), 0, 0, 1); enemyCam[25].init(&camBox, enBullets[25], 2.0f, Vector3(60,0,30), Vector3(0,0,0), 0, 0, 1); enemyCam[26].init(&camBox, enBullets[26], 2.0f, Vector3(90,0,30), Vector3(0,0,0), 0, 0, 1); enemyCam[27].init(&camBox, enBullets[27], 2.0f, Vector3(90,0,10), Vector3(0,0,0), 0, 0, 1); enemyCam[28].init(&camBox, enBullets[28], 2.0f, Vector3(30,0,5), Vector3(0,0,0), 0, 0, 1); enemyCam[29].init(&camBox, enBullets[29], 2.0f, Vector3(70,0,-20), Vector3(0,0,0), 0, 0, 1); enemyCam[30].init(&camBox, enBullets[30], 2.0f, Vector3(90,0,-20), Vector3(0,0,0), 0, 0, 1); enemyCam[31].init(&camBox, enBullets[31], 2.0f, Vector3(90,0,-90), Vector3(0,0,0), 0, 0, 1); enemyCam[32].init(&camBox, enBullets[32], 2.0f, Vector3(55,0,-65), Vector3(0,0,0), 0, 0, 1); enemyCam[33].init(&camBox, enBullets[33], 2.0f, Vector3(30,0,-92), Vector3(0,0,0), 0, 0, 1); enemyCam[34].init(&camBox, enBullets[34], 2.0f, Vector3(-8,0,-60), Vector3(0,0,0), 0, 0, 1); enemyCam[35].init(&camBox, enBullets[35], 2.0f, Vector3(10,0,-5), Vector3(0,0,0), 0, 0, 1); enemyCam[36].init(&camBox, enBullets[36], 2.0f, Vector3(10,0,-25), Vector3(0,0,0), 0, 0, 1); enemyCam[37].init(&camBox, enBullets[37], 2.0f, Vector3(10,0,-45), Vector3(0,0,0), 0, 0, 1); enemyCam[38].init(&camBox, enBullets[38], 2.0f, Vector3(10,0,-65), Vector3(0,0,0), 0, 0, 1); enemyCam[39].init(&camBox, enBullets[39], 2.0f, Vector3(20,0,-15), Vector3(0,0,0), 0, 0, 1); enemyCam[40].init(&camBox, enBullets[40], 2.0f, Vector3(20,0,-35), Vector3(0,0,0), 0, 0, 1); enemyCam[41].init(&camBox, enBullets[41], 2.0f, Vector3(20,0,-55), Vector3(0,0,0), 0, 0, 1); enemyCam[42].init(&camBox, enBullets[42], 2.0f, Vector3(20,0,-75), Vector3(0,0,0), 0, 0, 1); enemyCam[43].init(&camBox, enBullets[43], 2.0f, Vector3(30,0,-5), Vector3(0,0,0), 0, 0, 1); enemyCam[44].init(&camBox, enBullets[44], 2.0f, Vector3(30,0,-25), Vector3(0,0,0), 0, 0, 1); enemyCam[45].init(&camBox, enBullets[45], 2.0f, Vector3(30,0,-45), Vector3(0,0,0), 0, 0, 1); enemyCam[46].init(&camBox, enBullets[46], 2.0f, Vector3(30,0,-65), Vector3(0,0,0), 0, 0, 1); enemyCam[47].init(&camBox, enBullets[47], 2.0f, Vector3(40,0,-15), Vector3(0,0,0), 0, 0, 1); enemyCam[48].init(&camBox, enBullets[48], 2.0f, Vector3(40,0,-35), Vector3(0,0,0), 0, 0, 1); enemyCam[49].init(&camBox, enBullets[49], 2.0f, Vector3(40,0,-55), Vector3(0,0,0), 0, 0, 1); enemyCam[50].init(&camBox, enBullets[50], 2.0f, Vector3(40,0,-75), Vector3(0,0,0), 0, 0, 1); enemyCam[51].init(&camBox, enBullets[51], 2.0f, Vector3(-25,0,6), Vector3(0,0,0), 0, 0, 1); enemyCam[52].init(&camBox, enBullets[52], 2.0f, Vector3(-25,0,-6), Vector3(0,0,0), 0, 0, 1); enemyCam[53].init(&camBox, enBullets[53], 2.0f, Vector3(-25,0,-43), Vector3(0,0,0), 0, 0, 1); enemyCam[54].init(&camBox, enBullets[54], 2.0f, Vector3(-35,0,-6), Vector3(0,0,0), 0, 0, 1); enemyCam[55].init(&camBox, enBullets[55], 2.0f, Vector3(-35,0,-43), Vector3(0,0,0), 0, 0, 1); enemyCam[56].init(&camBox, enBullets[56], 2.0f, Vector3(-50,0,-25), Vector3(0,0,0), 0, 0, 1); enemyCam[57].init(&camBox, enBullets[57], 2.0f, Vector3(-10,0,-25), Vector3(0,0,0), 0, 0, 1); enemyCam[58].init(&camBox, enBullets[58], 2.0f, Vector3(-65,0,-45), Vector3(0,0,0), 0, 0, 1); enemyCam[59].init(&camBox, enBullets[59], 2.0f, Vector3(-75,0,-45), Vector3(0,0,0), 0, 0, 1); enemyCam[60].init(&camBox, enBullets[60], 2.0f, Vector3(-95,0,-15), Vector3(0,0,0), 0, 0, 1); enemyCam[61].init(&camBox, enBullets[61], 2.0f, Vector3(-95,0,-50), Vector3(0,0,0), 0, 0, 1); enemyCam[62].init(&camBox, enBullets[62], 2.0f, Vector3(-95,0,-95), Vector3(0,0,0), 0, 0, 1); enemyCam[63].init(&camBox, enBullets[63], 2.0f, Vector3(-33,0,-95), Vector3(0,0,0), 0, 0, 1); enemyCam[64].init(&camBox, enBullets[64], 2.0f, Vector3(-46,0,-95), Vector3(0,0,0), 0, 0, 1); enemyCam[65].init(&camBox, enBullets[65], 2.0f, Vector3(-59,0,-95), Vector3(0,0,0), 0, 0, 1); enemyCam[66].init(&camBox, enBullets[66], 2.0f, Vector3(-72,0,-95), Vector3(0,0,0), 0, 0, 1); enemyCam[67].init(&camBox, enBullets[67], 2.0f, Vector3(-20,0,-75), Vector3(0,0,0), 0, 0, 1); enemyCam[68].init(&camBox, enBullets[68], 2.0f, Vector3(-33,0,-75), Vector3(0,0,0), 0, 0, 1); enemyCam[69].init(&camBox, enBullets[69], 2.0f, Vector3(-46,0,-75), Vector3(0,0,0), 0, 0, 1); enemyCam[70].init(&camBox, enBullets[70], 2.0f, Vector3(-59,0,-75), Vector3(0,0,0), 0, 0, 1); enemyCam[71].init(&camBox, enBullets[71], 2.0f, Vector3(-72,0,-75), Vector3(0,0,0), 0, 0, 1); enemyCam[72].init(&camBox, enBullets[72], 2.0f, Vector3(-20,0,-55), Vector3(0,0,0), 0, 0, 1); enemyCam[73].init(&camBox, enBullets[73], 2.0f, Vector3(-33,0,-55), Vector3(0,0,0), 0, 0, 1); enemyCam[74].init(&camBox, enBullets[74], 2.0f, Vector3(-46,0,-55), Vector3(0,0,0), 0, 0, 1); enemyCam[75].init(&camBox, enBullets[75], 2.0f, Vector3(-59,0,-55), Vector3(0,0,0), 0, 0, 1); enemyCam[76].init(&camBox, enBullets[76], 2.0f, Vector3(-72,0,-55), Vector3(0,0,0), 0, 0, 1); enemyCam[77].init(&blueBox, enBullets[77], 2.0f, Vector3(-20,0,-95), Vector3(0,0,0), 0, 0, 1); //dunstan will always be the last camera in the list #pragma endregion for(int i=0; i<gameNS::NUM_MONEY; i++) { money[i].init(&goldBox, 2.0f, Vector3(rand()%190 - 90, 0, rand()%180 - 90), Vector3(0,0,0), 0, 1, rand()%2); } //Initializing text strings yay sText.addLine("WELCOME RUGGER !", 10, 10); sText.addLine("WASD TO MOVE", 10, 30); sText.addLine("ARROW KEYS TO SHOOT", 10, 50); sText.addLine("HOLD SHIFT TO SPRINT!", 10, 70); sText.addLine("GO KILL DUNSTAN FOR ME!", 10, 90); sText.addLine("PRESS ANY KEY TO BEGIN !", 250, 300); eText.addLine("CONGRATS RUGGER I WON!", 250, 300); shotTimer = 0; buildFX(); buildVertexLayouts(); audio->playCue(MUSIC); }