当前位置: 首页>>代码示例>>C++>>正文


C++ Boss类代码示例

本文整理汇总了C++中Boss的典型用法代码示例。如果您正苦于以下问题:C++ Boss类的具体用法?C++ Boss怎么用?C++ Boss使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Boss类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: assert

void Game::ResetGame()
{
  std::vector<std::string> enemies;
  enemies.push_back("Enemy1");
  enemies.push_back("Enemy2");
  enemies.push_back("Enemy3");

  for(unsigned int i = 0; i < enemies.size(); i++)
  {
  AIShip* enemy = dynamic_cast<AIShip*>(Game::GetGameObjectManager().Get(enemies[i]));
	assert(NULL != enemy);
	
	enemy->setElapsedTime(0);
  }
  WeaponPowerUp* weapon = dynamic_cast<WeaponPowerUp*>(Game::GetGameObjectManager().Get("WeaponPowerUp"));
  assert(NULL != weapon);
  weapon->setPowerUpLevel(1);
  weapon->setElapsedTime(20.f);
  weapon->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
  
  ShieldPowerUp* shield = dynamic_cast<ShieldPowerUp*>(Game::GetGameObjectManager().Get("ShieldPowerUp"));
  assert(NULL != weapon);
  shield->setElapsedTime(10.f);
  shield->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
  _score = 0;

  Boss* boss = dynamic_cast<Boss*>(Game::GetGameObjectManager().Get("Boss"));
  assert(NULL != boss);
  boss->setElapsedTime(0.f);

   AILaser* laser1 = dynamic_cast<AILaser*>(Game::GetGameObjectManager().Get("AILaser1"));
  assert(NULL != laser1);
  laser1->setElapsedTime(0.f);
  laser1->setSpeed(0.f);
  laser1->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);

  AILaser2* laser2 = dynamic_cast<AILaser2*>(Game::GetGameObjectManager().Get("AILaser2"));
  assert(NULL != laser2);
  laser2->setElapsedTime(0.f);
  laser2->setSpeed(0.f);
  laser2->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);

  AILaser3* laser3 = dynamic_cast<AILaser3*>(Game::GetGameObjectManager().Get("AILaser3"));
  assert(NULL != laser3);
  laser3->setElapsedTime(0.f);
  laser3->setSpeed(0.f);
  laser3->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);

  BossLaser* blaser = dynamic_cast<BossLaser*>(Game::GetGameObjectManager().Get("BossLaser"));
  assert(NULL != blaser);
  blaser->setElapsedTime(0.f);
  blaser->setSpeed(0.f,0.f);
  blaser->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);




  
}
开发者ID:NicodySazawa,项目名称:Paint_Wars_C_Plus_Plus_Sample,代码行数:59,代码来源:game.cpp

示例2: main

int main()
{
	Boss * boss = new Boss;
	boss->Doing();
	
	delete boss;
	return 0;
}
开发者ID:wa123fei,项目名称:SomeCppCode,代码行数:8,代码来源:ChainofResponsibility.cpp

示例3: PlayerShip

void Game::Start(void)
{
  if(_gameState != Uninitialized)
    return;

  _mainWindow.Create(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32),"Paint Wars!");

  SFMLSoundProvider soundProvider;
  ServiceLocator::RegisterAudioService(&soundProvider);

  ServiceLocator::GetAudio()->PlaySong("assets/NewSoundtrack.ogg",true);

  PlayerShip *player1 = new PlayerShip();
  player1->SetPosition(SCREEN_WIDTH/2, _gameField.Bottom - 40);
  _gameObjectManager.Add("Ship1", player1);
  Laser *laser1 = new Laser();
  laser1->SetPosition(Game::SCREEN_WIDTH / 2, Game::SCREEN_HEIGHT + 100);
  _gameObjectManager.Add("Laser1", laser1);
   AIShip *enemy1 = new AIShip();
   enemy1->SetPosition(SCREEN_WIDTH/2, _gameField.Top);
   _gameObjectManager.Add("Enemy1", enemy1);
   AIShip *enemy2 = new AIShip();
   enemy2->SetPosition(SCREEN_WIDTH/2, _gameField.Top);
   _gameObjectManager.Add("Enemy2", enemy2);
   AIShip *enemy3 = new AIShip();
   enemy3->SetPosition(SCREEN_WIDTH/2, _gameField.Top);
   _gameObjectManager.Add("Enemy3", enemy3);
   AILaser *ailaser1 = new AILaser();
   ailaser1->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("AILaser1", ailaser1);
   AILaser2 *ailaser2 = new AILaser2();
   ailaser2->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("AILaser2", ailaser2);
   AILaser3 *ailaser3 = new AILaser3();
   ailaser3->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("AILaser3", ailaser3);
   Boss *boss = new Boss();
   boss->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("Boss", boss);
   BossLaser *bosslaser = new BossLaser();
   bosslaser->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("BossLaser",bosslaser);
   WeaponPowerUp *weaponpowerup = new WeaponPowerUp();
    weaponpowerup->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("WeaponPowerUp",weaponpowerup);
    ShieldPowerUp *shieldpowerup = new ShieldPowerUp();
    shieldpowerup->SetPosition(SCREEN_WIDTH/2, _gameField.Top - 100);
   _gameObjectManager.Add("ShieldPowerUp",shieldpowerup);
   
   _gameState = Game::ShowingSplash;

  while(!IsExiting())
  {
    GameLoop();
  }

  _mainWindow.Close();
}
开发者ID:NicodySazawa,项目名称:Paint_Wars_C_Plus_Plus_Sample,代码行数:58,代码来源:game.cpp

示例4: keyboard

//take keyboard input into account
void keyboard(unsigned char key, int x, int y)
{
    //printf("Keydown %d, cursor pos (%d,%d)\n",key,x,y);
    //fflush(stdout);
    keyPressed[key] = true;

	if ((key>='1')&&(key<='9'))
	{
		DisplayMode= (DisplayModeType) (key-'0');
		return;
	}
    
    updateCharacterMovementDirection();
    
	switch (key)
    {
    case 'm': {
        if (MouseMode == MOUSE_MODE_SHOOTING) {
            MouseMode = MOUSE_MODE_CAMERA;
        }
        else if (MouseMode == MOUSE_MODE_CAMERA) {
            MouseMode = MOUSE_MODE_SHOOTING;
        }
        break;
    }
	case 27:     // touche ESC
        exit(0);
	case 'L':
		//turn lighting on
		glEnable(GL_LIGHTING);
		break;
	case 'l':
		//turn lighting off
		glDisable(GL_LIGHTING);
		break;
	case 'b':
		spawnBoss(0);
		break;
	case 'j':
		if (boss.position[0] <= 0)
			boss.setDestination(Vec3Df(-2, -1, -0.5), 1);
		else
			boss.setDestination(Vec3Df(0, -1, -1), 1);
		break;
	case 'k':
		if (boss.position[0] >= 0)
			boss.setDestination(Vec3Df(2, -1, 0), 1);
		else
			boss.setDestination(Vec3Df(0, -1, 0.5), 1);
		break;
	case '+':
		meshIndex = ++meshIndex % meshes.size();
		break;
    }
}
开发者ID:DustinLim,项目名称:IN4152-game,代码行数:56,代码来源:main.cpp

示例5: computeLighting

/// Computes lighting for the entire scene
void computeLighting()
{
    for (auto &ridge : mountains)
    {
        for (int i=0; i < ridge.meshVertices.size(); i = i+3)
        {
            // Compute for our (single) light
            Vec3Df vertexpos = Vec3Df(ridge.meshVertices[i],
                                      ridge.meshVertices[i+1],
                                      ridge.meshVertices[i+2]);
            Vec3Df normal = Vec3Df(ridge.meshNormals[i],
                                   ridge.meshNormals[i+1],
                                   ridge.meshNormals[i+2]);
            Vec3Df lighting = computeLighting(vertexpos, normal, DIFFUSE_LIGHTING);
            
            // Pass computed values to Ridge
            ridge.meshColors[i] = lighting[0];
            ridge.meshColors[i+1] = lighting[1];
            ridge.meshColors[i+2] = lighting[2];
        }
    }
	
	if (toggleBoss) {
		std::vector<Vertex> vertices = boss.getMesh().vertices;
		std::vector<Vec3Df> meshColors = std::vector<Vec3Df>(vertices.size());

		auto rotMat = matrixMultiplication(
			rotateMatrixY(boss.angleHeadY*M_PI / 180),
			rotateMatrixX(boss.angleHeadZ*M_PI / 180)
			);

		for (int i = 0; i < vertices.size(); i++)
		{
			// Compute for our (single) light
			Vertex vertex = vertices[i];
			Vec3Df vec = vertex.p;
			vec = calculateMatrix(rotMat, vec);
			vec = vec + boss.translation;
			vec = vec * boss.scale;
			vec = vec + boss.position;

			Vec3Df nor = vertex.n;
			nor = calculateMatrix(rotMat, nor);
			nor = nor + boss.translation;
			nor = nor * boss.scale;
			nor = nor + boss.position;

			Vec3Df lighting = computeLighting(vec, nor, PHONG_LIGHTNING);

			meshColors[i] = lighting;
		}
		boss.getMesh().meshColor = meshColors;
	}
}
开发者ID:DustinLim,项目名称:IN4152-game,代码行数:55,代码来源:main.cpp

示例6: Boss

Boss* Boss::create(Sprite* sprite, int ps)
{
	Boss *boss = new Boss();
	boss->m_Ps = (PowerEnumStatus)ps;                 //怪物类型
	if (boss && boss->initWithFile(sprite))
	{
		boss->autorelease();
		return boss;
	}
	CC_SAFE_DELETE(boss);
	return NULL;
}
开发者ID:zsn6493,项目名称:EATFUZI,代码行数:12,代码来源:Boss.cpp

示例7: ERR

int bossMgr::combatResult(chessCombat* pCombat)    //boss战斗结束
{
    if (NULL == pCombat)
    {
        ERR();
        return HC_ERROR;
    }
    Boss* pb = getBoss(pCombat->m_data_id).get();
    if (NULL == pb)
    {
        ERR();
        return HC_ERROR;
    }
    return pb->combatResult(pCombat);
}
开发者ID:lindianyin,项目名称:sgbj,代码行数:15,代码来源:boss.cpp

示例8: main

int main(int argc, char* argv[])
{
	Boss* b = new Boss("胡汉三回来了");
	StockObserver* so = new StockObserver("张博",b);
	NBAObserver* no = new NBAObserver("赵书淇",b);

	b->Attach(so);
	b->Attach(no);

	b->Notify();

	cin.ignore();

	return 0;
}
开发者ID:vamprier,项目名称:Observer,代码行数:15,代码来源:main.cpp

示例9: main

int main()
{
	Enemy enemy;
	Boss boss;

	cout << "Enemy: " << endl;
	enemy.Attack();

	cout << endl;
	
	cout << "Boss: " << endl;
	boss.Attack();
	boss.MegaAttack();

	return 0;
}
开发者ID:Xyzyx101,项目名称:cPlusPlusProjects,代码行数:16,代码来源:main.cpp

示例10: main

int main(int argc, char const *argv[])
{
	Boss* huhansan = new Boss();

	StockObserver* tongshi1 = new StockObserver("aaa",huhansan);
	StockObserver* tongshi2 = new StockObserver("bbb",huhansan);

	huhansan->Attach(tongshi1);
	huhansan->Attach(tongshi2);

	huhansan->Detach(tongshi1);

	huhansan->setSubjectState("我胡汉三回来了");
	huhansan->Notify();
	return 0;
}
开发者ID:Mericusta,项目名称:CPP,代码行数:16,代码来源:OververPatternExample.cpp

示例11: main

int main()
{
	Enemy e;
	e.Attack();

	Boss b;

	b.Attack();

	std::cout << std::endl;
	b.SpecialAttack();

	b.Taunt();

	std::cout << std::endl;
	

	std::cin.get();
	return 0;
}
开发者ID:JustinMorritt,项目名称:C-,代码行数:20,代码来源:main.cpp

示例12: EnemyPlane1

void Logic::create_enemy(float t){//生产敌机的逻辑
	t*=50;
	int flag=(int)t;
	if(flag%100==0 && flag<=1500){
		EnemyPlane1* temp = new EnemyPlane1(*enemy_type[0]);
		EnemyPlane1* temp1 = new EnemyPlane1(*enemy_type[0]);
		temp->set_pos(Position(-temp->getwidth()/2,-temp->getheight()/2));
		temp1->set_pos(Position(win_width+temp1->getwidth()/2,-temp->getheight()/2));
		enemy.push_back(temp);
		enemy.push_back(temp1);
	}

	if(flag%400==0 && flag>400 && flag<=3200){
		EnemyPlane2* temp = new EnemyPlane2(*enemy_type[1]);
		EnemyPlane2* temp1 = new EnemyPlane2(*enemy_type[1]);
		EnemyPlane2* temp2 = new EnemyPlane2(*enemy_type[1]);
		temp->set_pos(Position(win_width/2,-temp->getheight()/2));
		temp1->set_pos(Position(win_width/4,-temp->getheight()/2));
		temp2->set_pos(Position(win_width*3/4,-temp->getheight()/2));
		enemy.push_back(temp);
		enemy.push_back(temp1);
		enemy.push_back(temp2);
	}

	if(flag%100==0&&flag>1000 && flag<=3600){
		EnemyPlane3* temp1 = new EnemyPlane3(*enemy_type[2]);
		EnemyPlane3* temp2 = new EnemyPlane3(*enemy_type[2]);
		int range = int(win_width - temp1->getwidth());
		float start = temp1->getwidth()/2;
		temp1->set_pos(Position(start+rand()%range,-temp1->getheight()/2));
		temp2->set_pos(Position(start+rand()%range,-temp2->getheight()/2));
		enemy.push_back(temp1);
		enemy.push_back(temp2);
	}

	if(flag == 3600){
		Boss* temp = new Boss(*enemy_type[3]);
		temp->set_pos(Position(win_width/2,-temp->getheight()/2));
		enemy.push_back(temp);
	}
}
开发者ID:smartczh,项目名称:PlanFightGame,代码行数:41,代码来源:logic.cpp

示例13: display

void display( )
{
	switch( DisplayMode )
	{
	case GAME:
	{
		glLightfv(GL_LIGHT0, GL_POSITION, LightPos);
		drawLightPosition();
		//drawCoordinateSystem();

		// Note that drawing order has consequences for 'transparancy'
		background->draw();
		for (int i = 0; i < numberOfRidges; i++)
		{
			mountains[i].draw();
		}
		groundfloor->draw();
		
		if (toggleBoss)
			boss.draw();

		glDisable(GL_DEPTH_TEST);
		for (auto &projectile : projectiles) {
			projectile.draw();
		}
		glEnable(GL_DEPTH_TEST);

        character.draw();
		for (auto &enemy : enemies) {
			enemy.draw();
		}
		break;
	}
    case MESH:
    {
        glEnable(GL_LIGHTING);
        glPushMatrix();
		//David:
        //glRotatef(-90.0f, 0.0f, 0.0f, 1.0f);
        //glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
		//hoofd
		//glRotatef(90.0f, 0.0f, 0.0f, 1.0f);
		//glRotatef(-90.0f, 1.0f, 0.0f, 0.0f);
        meshes[meshIndex].drawSmooth();
        glPopMatrix();
        glDisable(GL_LIGHTING);
        break;
    }
	default:
		break;
	}
}
开发者ID:DustinLim,项目名称:IN4152-game,代码行数:52,代码来源:main.cpp

示例14: animate

/**
 * Animation function, only put animation code here!
 * That is to say, code that updates positioning of drawables.
 */
void animate( )
{
	int currentTime = glutGet(GLUT_ELAPSED_TIME);
	int deltaTime = currentTime - glutElapsedTime;
	glutElapsedTime = currentTime;


    LightPos[0] += 0.002;
    
	for (int i = 0; i < numberOfRidges; i++)
	{
		mountains[i].move(deltaTime);
	}
	background->move(deltaTime);
	groundfloor->move(deltaTime);


	for (auto &enemy : enemies) {
		enemy.animate(deltaTime);
	}
	for (auto &projectile : projectiles) {
		projectile.animate(deltaTime);
	}

	character.animate(deltaTime);
	character.position[0] = std::fmax(character.position[0], topLeft[0] + (character.width / 2.0f) * character.scale);
	character.position[0] = std::fmin(character.position[0], bottomRight[0] - (character.width / 2.0f) * character.scale);

	character.position[1] = std::fmin(character.position[1], topLeft[1] - (character.height / 2.0f) * character.scale);
	character.position[1] = std::fmax(character.position[1], bottomRight[1] + (character.height / 2.0f) * character.scale + 1.0);

	if (toggleBoss)
		boss.animate(deltaTime);

	collisionDetection();

    // After everything has moved, lighting should be recalculated
    computeLighting();
}
开发者ID:DustinLim,项目名称:IN4152-game,代码行数:43,代码来源:main.cpp

示例15: Boss

Boss * Boss::create(const BossConfig * pConfig) {
    Boss * ret = NEW Boss(pConfig);
    ret->autorelease();
    
    return ret;
}
开发者ID:joyfish,项目名称:PlaneWar,代码行数:6,代码来源:Boss.cpp


注:本文中的Boss类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。