Esempio n. 1
0
void Ant::attack()
{
	Actor *pTarget = ActorHandler::getInstance()->getActor(mTarget);
	mCooldownCounter = mpGlobalTimer->getTime(utilities::Timer::ReturnType_Seconds) - mCooldownStartTime;
	//check if cooldownCounter is higher than weaponCooldown
	if(mCooldownCounter > 1.0f)
	{
		Tank *pTank = dynamic_cast<Tank*>(pTarget);
		Driver *pDriver = dynamic_cast<Driver*>(pTarget);
		mCooldownStartTime = mpGlobalTimer->getTime(utilities::Timer::ReturnType_Seconds);
		
		if(pTank != NULL)
		{
			safeThreadSafeQueueEvent(EventDataPtr(myNew EvtData_From_EnemyMeleeAttack(this->getKey())));
			pTank->reduceHp(mDamage);	
		}

		else if(pDriver != NULL)
		{
			safeThreadSafeQueueEvent(EventDataPtr(myNew EvtData_From_EnemyMeleeAttack(this->getKey())));
			pDriver->reduceHp(mDamage);
		}
	}
  //send event to have the enemy perform his attack animation
  //send event to collision checking for a hit
}
void ManualTankState::onKeyPress(uint16_t keyCode)
{
    Tank * tank =  getTank();
    
    if(tank == NULL)
        return;

    switch(keyCode)
    {
        case IR_BUTTON_A: tank->setMode(Auto); break;
        case IR_BUTTON_B: break;
        case IR_BUTTON_C: tank->setMode(Parking); break;
        case IR_BUTTON_D: break;
        case IR_BUTTON_E: break;
        case IR_BUTTON_F: break;
        case IR_BUTTON_SETTING: tank->stop(); break;
        case IR_BUTTON_UP: tank->getCurrentMove() == Forward ? tank->forward(_baseSpeed * 2): tank->forward(_baseSpeed);  break;
        case IR_BUTTON_DOWN: tank->getCurrentMove() == Backward ? tank->backward(_baseSpeed * 2) : tank->backward(_baseSpeed);  break;
        case IR_BUTTON_LEFT: tank->left(); break;
        case IR_BUTTON_RIGHT: tank->right(); break;
        case IR_BUTTON_0: break;
        case IR_BUTTON_1: break;
        case IR_BUTTON_2: break;
        case IR_BUTTON_3: break;
        case IR_BUTTON_4: break;
        case IR_BUTTON_5: break;
        case IR_BUTTON_6: break;
        case IR_BUTTON_7: break;
        case IR_BUTTON_8: break;
        case IR_BUTTON_9: break;
        default:break;
    }
    
}
Esempio n. 3
0
bool IsStuck( Tank & self )
{
	double sx = fabs( self.speed_x() );
	double sy = fabs( self.speed_y() );

	speed_stat.push_back( SpeedStat(sx, sy) );

	if (speed_stat.size() > 50)
	{
		speed_stat.erase( speed_stat.begin() );
	}
	else
	{
		return false;
	}

	double avg_x = 0.0, avg_y = 0.0;

	for (int i = 0; i < speed_stat.size(); ++i)
	{
		avg_x += speed_stat[i].m_sx;
		avg_y += speed_stat[i].m_sy;
	}

	avg_x = avg_x / speed_stat.size();
	avg_y = avg_y / speed_stat.size();

	if (avg_x < min_stuck_speed && avg_y < min_stuck_speed)
	{
		stuck_tick = stuck_period;
		return true;
	}

	return false;
}
Esempio n. 4
0
void QualEngine::init()
{
    if (engineState != QualEngine::OPENED) return;

    // ... initialize node concentrations & tank volumes

    for (Node* node : network->nodes)
    {
        if ( network->qualModel->type == QualModel::TRACE ) node->quality = 0.0;
        else node->quality = node->initQual;
        if ( node->type() == Node::TANK )
        {
            Tank* tank = static_cast<Tank*>(node);
            tank->volume = tank->findVolume(tank->initHead);
        }
    }

    // ... initialize reaction model and quality solver

    qualSolver->init();
    network->qualModel->init(network);
    qualStep = network->option(Options::QUAL_STEP);
    if ( qualStep <= 0 ) qualStep = 300;
    qualTime = 0;
    engineState = QualEngine::INITIALIZED;
}
Esempio n. 5
0
bool MoveTurretOrShoot( Tank * pEnemy, Tank & self, World & world, model::Move& move, double offset )
{
	double angle_to_enemy = self.GetTurretAngleTo(*pEnemy);

    if (angle_to_enemy + offset > ( MIN_ANGLE) ) 
	{	
		move.set_turret_turn(1.0);  
    } 
	else if (angle_to_enemy + offset < ( -MIN_ANGLE ) ) 
	{
		move.set_turret_turn(-1.0);
	} 
	else 
	{
		//vector<Tank> t = world.tanks();

		//if ( ! EnemyBlocked(pEnemy, self, t) ) /* decide to shoot here, path may block */
		//{
			/* burst if we almoust alone */

			if ( EnemyIsWalkingDead( pEnemy ) || self.premium_shell_count() > 3 )
			{
				move.set_fire_type(PREMIUM_PREFERRED);
			}
			else
			{
				move.set_fire_type(REGULAR_FIRE);
			}

			return true;
		//}
	}

	return false;
}
Esempio n. 6
0
bool EnemyBlocked( Tank * pEnemy, Tank & self, vector<Tank> & t )
{
	double my_angle = self.GetAngleTo( *pEnemy );
	double my_dist = self.GetDistanceTo( *pEnemy );

	for (int i = 0; i < t.size(); ++i)
	{
		if (t[i].id() == pEnemy->id() || t[i].id() == self.id())
		{
			continue;
		}

		double max_wh = std::max( t[i].width(), t[i].height() );

		double alpha = fabs( self.GetAngleTo(t[i]) - my_angle );
		double his_dist = self.GetDistanceTo( t[i] );
		
		if (alpha > M_PI / 4)
		{
			continue;
		}
		
		double d_size = sin(alpha) * my_dist;

		if ( d_size <= max_wh/2 && his_dist < my_dist )
		{
			return true;
		}
	}

	return false;
}
Esempio n. 7
0
double Car::budget_consumption_byType(unsigned int id)
{
    /* Return sum(fuel price) / ODO * 100 for fueltype */
    // We will calculate only full refills as partial refills cannat be calculated correctly
    double totalDistance=0;
    double totalQuantity=0;
    //go to last tankstop
    Tank *curTank = _tanklist.first();
    const Tank *prevTank=NULL;
    while (curTank)
    {
        prevTank=previousTank(curTank->distance());
        if (!(prevTank==NULL))
        {
            //prevous tank must have correct fueltype
            if (prevTank->fueltype()==id)
                if (prevTank->full())
                {
                    totalDistance += curTank->distance()-prevTank->distance();
                    totalQuantity += curTank->quantity();
                }
            //cannot set curTank to prevTank as it is const
            curTank=NULL;
            foreach(Tank *tmp,_tanklist)
            {
                if (tmp->id()==prevTank->id())
                    curTank=tmp;
            }
        }
        else {
            curTank=NULL;
        }
    }
Esempio n. 8
0
void World::moveBullets()
{
	for (int q = 0; q < _bulletList.size(); q++) {
		if (_bulletList[q]->getKillAnimation() != 0) {
			if (_bulletList[q]->getKillAnimation() == 10) {
				delete _bulletList[q];
				_bulletList.remove(q);
			} else {
				_bulletList[q]->animation();
			}
		} else {
			QPoint pos = _bulletList[q]->getPos();
			bool withTank;
			void *status = testCollision(_bulletList[q]->getSpeed(), _bulletList[q], false, &withTank);
			if (status == nullptr) {
				switch (_bulletList[q]->getAngle()) {
					case 0: {
						_bulletList[q]->setPos(QPoint(pos.x(), pos.y() - _bulletList[q]->getSpeed()));
						break;
					}
					case 1: {
						_bulletList[q]->setPos(QPoint(pos.x() + _bulletList[q]->getSpeed(), pos.y()));
						break;
					}
					case 2: {
						_bulletList[q]->setPos(QPoint(pos.x(), pos.y() + _bulletList[q]->getSpeed()));
						break;
					}
					case 3: {
						_bulletList[q]->setPos(QPoint(pos.x() - _bulletList[q]->getSpeed(), pos.y()));
						break;
					}
				}
			} else {
				if (withTank) {
					Tank *tank = ((Tank*)status);
					tank->hit();
					if (tank->getHp() == 0) {
						tank->setSize(0);
					}
				} else {
					Wall *wall = ((Wall*)status);
					wall->hit();
					if (wall->getHp() == 0) {
						for (int i = 0; i < _wallList.size(); i++) {
							if (_wallList[i] == wall) {
								if (_wallList[i] == _playerBase) {
									_playerBase = nullptr;
								}
								delete _wallList[i];
								_wallList.remove(i);
							}
						}
					}
				}
				_bulletList[q]->animation();
			}
		}
	}
}
Esempio n. 9
0
	void TankFactory::updateAllTankStatus(float time){
		for (TankIterator t = tankList.begin(); t != tankList.end();){ //t shouldn't be increment in for loop, may cause program crashes.
				Tank* tank = *t;             
				tank->update(time);
				if (tank->ifExplodeFinished())
				{	
					if(tank->getType() != TANK_PLAYER){
						//delete tank
						destroyTank(tank);
						Tank* tmp = tank;
						t++;
						tankList.remove(tmp);
					}else{
						destroyTank(tank);
						Tank* tmp = tank;
						t++;
						tankList.remove(tmp);
						rebornPlayer();
					}	
				}
				else
				{
					t++;
				}
		}
	}
void KamikazeAnt::attack()
{
	Actor* pActor = ActorHandler::getInstance()->getActor(mpsPlayerInfo->getPlayerId());
	if(pActor != NULL && (pActor->getPosition() - mPosition).longerThan(Enemy::getRange(), false) == false && mId.isOwner())
	{
		mCooldownCounter = mpGlobalTimer->getTime(utilities::Timer::ReturnType_Seconds) - mCooldownStartTime;
		//check if cooldownCounter is higher than weaponCooldown
		if(mCooldownCounter > 1.0f)
		{
			Tank *pTank = dynamic_cast<Tank*>(pActor);
			Driver *pDriver = dynamic_cast<Driver*>(pActor);
			mCooldownStartTime = mpGlobalTimer->getTime(utilities::Timer::ReturnType_Seconds);

			if(pTank != NULL)
			{
				safeQueueEvent(EventDataPtr(myNew EvtData_From_KamikazeAntExplode(this->getKey())));
				pTank->reduceHp(50);
				this->reduceHp(200);
			}

			else if(pDriver != NULL)
			{
				safeQueueEvent(EventDataPtr(myNew EvtData_From_KamikazeAntExplode(this->getKey())));
				pDriver->reduceHp(50);
				this->reduceHp(200);
			}
		}

	}
}
Esempio n. 11
0
bool Block::IsCollide(Object* obj)
{
   if (obj->type() == OBJ_TANK)
   {
      Tank* pTank = dynamic_cast<Tank*>(obj);
      Point pt = pTank->GetPosition();
      LONG r = pTank->GetRadius();
      for (int i = 0; i < hp/25 + 1; i++)
      {
         if (Collision(rc[i], pt, r))
            return true;
      }
   }
   else if (obj->type() == OBJ_BULLET)
   {
      Bullet* pBullet = dynamic_cast<Bullet*>(obj);
      Point pt = pBullet->GetPosition();
      LONG r = pBullet->GetRadius();
      for (int i = 0; i < hp/25 + 1; i++)
      {
         if (Collision(rc[i], pt, r))
            return true;
      }
   }

   return false;
}
Esempio n. 12
0
void mySpecialKeyboard(int key, int x, int y)
{
	switch (key) {
	case GLUT_KEY_LEFT:				//move to left
		myTank.plusAngleWithX(gAngleTankDelta);
		break;
	case GLUT_KEY_RIGHT:			//move to right
		myTank.plusAngleWithX(-gAngleTankDelta);
		break;
	case GLUT_KEY_UP:				//move to up
		myTank.move(gMoveDelta);
		break;
	case GLUT_KEY_DOWN:				//move to right
		myTank.move(-gMoveDelta);
		break;
	case GLUT_KEY_F1:				//view 1
		gViewMode = 0;
		break;
	case GLUT_KEY_F2:				//view 2
		gViewMode = 1;
		break;
	case GLUT_KEY_F3:				//view 3
		gViewMode = 2;
		break;
	}
}
Esempio n. 13
0
int HydEngine::timeToCloseTank(int tstep)
{
    Tank* closedTank = nullptr;
    for (Node* node : network->nodes)
    {
        // ... check if node is a tank

        if ( node->type() == Node::TANK )
        {
            // ... find the time to fill (or empty) the tank

            Tank* tank = static_cast<Tank*>(node);
            int t = tank->timeToVolume(tank->minVolume);
            if ( t <= 0 ) t = tank->timeToVolume(tank->maxVolume);

            // ... compare this time with current time step

            if ( t > 0 && t < tstep )
            {
                tstep = t;
                closedTank = tank;
            }
        }
    }
    if ( closedTank )
    {
        timeStepReason = "  (Tank " + closedTank->name + " closed)";
    }
    return tstep;
}
Esempio n. 14
0
void Ant::attack()
{
  //if enemy is in range of tank
	Actor* pActor = ActorHandler::getInstance()->getActor(mpsPlayerInfo->getPlayerId());
	if(pActor != NULL && (pActor->getPosition() - mPosition).longerThan(Enemy::getRange(), false) == false && mId.isOwner())
	{
		mCooldownCounter = mpGlobalTimer->getTime(utilities::Timer::ReturnType_Seconds) - mCooldownStartTime;
		//check if cooldownCounter is higher than weaponCooldown
		if(mCooldownCounter > 1.0f)
		{
			Tank *pTank = dynamic_cast<Tank*>(pActor);
			Driver *pDriver = dynamic_cast<Driver*>(pActor);
			mCooldownStartTime = mpGlobalTimer->getTime(utilities::Timer::ReturnType_Seconds);
			
			if(pTank != NULL)
			{
				safeQueueEvent(EventDataPtr(myNew EvtData_From_EnemyMeleeAttack(this->getKey())));
				pTank->reduceHp(15);	
			}

			else if(pDriver != NULL)
			{
				safeQueueEvent(EventDataPtr(myNew EvtData_From_EnemyMeleeAttack(this->getKey())));
				pDriver->reduceHp(15);
			}
		}

	}
  //send event to have the enemy perform his attack animation
  //send event to collision checking for a hit
}
Esempio n. 15
0
Tank *GameEngine::TankByID(int id)
{
    for(int i=0; i<vehicles.size(); i++) {
        Tank *t = vehicles.at(i);
        if(id == t->ID())
            return t;
    }
    return false;
}
int getTankValue(int param, Node* node, double* value, Network* nw)
{
    double lcf = nw->ucf(Units::LENGTH);
    double vcf = lcf * lcf * lcf;
    *value = 0.0;
    if ( node->type() != Node::TANK ) return 0;
    Tank* tank = static_cast<Tank*>(node);
    switch (param)
    {
    case EN_TANKLEVEL:
        *value = (tank->head - tank->elev) * lcf;
        break;
    case EN_INITVOLUME:
        *value = tank->findVolume(tank->head) * vcf;
        break;
    case EN_MIXMODEL:
        *value = tank->mixingModel.type;
        break;
    case EN_MIXZONEVOL:
        *value = (tank->mixingModel.fracMixed * tank->maxVolume) * vcf;
        break;
    case EN_TANKDIAM:
        *value = tank->diameter * lcf;
        break;
    case EN_MINVOLUME:
        *value = tank->minVolume * vcf;
        break;
    case EN_VOLCURVE:
        if ( tank->volCurve )
        {
            string name = tank->volCurve->name;
            int index = nw->indexOf(Element::CURVE, name);
            *value = index;
            if ( index < 0 ) return 205;
        }
        else *value = -1.0;
        break;
    case EN_MINLEVEL:
        *value = (tank->minHead - tank->elev) * lcf;
        break;
    case EN_MAXLEVEL:
        *value = (tank->maxHead - tank->elev) * lcf;
        break;
    case EN_MIXFRACTION:
        *value = tank->mixingModel.fracMixed;
        break;
    case EN_TANK_KBULK:
        *value = tank->bulkCoeff ;
        break;
    case EN_TANKVOLUME:
        *value = tank->volume * vcf;
        break;
    default: return 203;
    }
    return 0;
}
Esempio n. 17
0
void Car::addNewTank(QDate date, unsigned int distance, double quantity, double price, bool full, unsigned int station, QString note)
{
    Tank *tank = new Tank(date, distance, quantity, price, full, station, CREATE_NEW_EVENT, note, this);
    _tanklist.append(tank);
    qSort(_tanklist.begin(), _tanklist.end(), sortTankByDistance);
    tank->save();
    emit nbtankChanged(_tanklist.count());
    emit consumptionChanged(this->consumption());
    emit maxdistanceChanged(this->maxdistance());
    emit tanksChanged();
}
Esempio n. 18
0
Tank* Tank::createTankWithTankType(const char* tankTypeName, TileMapInfo* tileMapInfo)
{
    SpriteFrameCache* pCache = SpriteFrameCache::getInstance();
    pCache->addSpriteFramesWithFile("tank.plist");

    Tank* tank = new Tank();
    tank->initTankWithTankType(tankTypeName, tileMapInfo);
    tank->autorelease();

    return tank;
}
Esempio n. 19
0
void keyboardSpecialHandler(int key, int mooseX, int mooseY){
	/*if(key==GLUT_KEY_UP)//just for testing and fun
		myTank.barrelAngle++;
	else if(key==GLUT_KEY_DOWN)
		myTank.barrelAngle--;*/
	if(key==GLUT_KEY_LEFT)//just for testing and fun
		myTank.move(-1);
	else if(key==GLUT_KEY_RIGHT)
		myTank.move(1);
	glutPostRedisplay();
}
Esempio n. 20
0
void ForceModify(Tank & self, Unit & u, double & xForce, double & yForce, double neg_c)
{
		//double absBearing = fabs( u.angle() );
		double absBearing = self.GetAngleTo( u );

		/* from 0 to 2*PI */

		double distance = self.GetDistanceTo( u );

		xForce += neg_c * ( sin(absBearing) / (distance * distance) );
		yForce += neg_c * ( cos(absBearing) / (distance * distance) );
}
Esempio n. 21
0
Tank* Tank::createTankWithTankType(const char* tankTypeName, TileMapInfo* tileMapInfo)
{
	CCSpriteFrameCache* pCache = CCSpriteFrameCache::sharedSpriteFrameCache();
	pCache->addSpriteFramesWithFile("tank.plist");
	initActionSet();

	Tank* tank = new Tank();
	tank->initTankWithTankType(tankTypeName, tileMapInfo);
	tank->autorelease();

	return tank;
}
bool TankContainer::onContactBegin(PhysicsContact& contact)
{
	PhysicsBody* bodyA = contact.getShapeA()->getBody();
	PhysicsBody* bodyB = contact.getShapeB()->getBody();
	if ((bodyA->getTag() == 1) && (bodyB->getTag() == 1)) //tanks
	{
		CCLOG("Contact 2 tanks");
		return true;
	}

	if ((bodyA->getTag() == 10) && (bodyB->getTag() == 10)) //bullets
	{
		CCLOG("Contact 2 bullets");
		return true;
	}

	if (((bodyA->getTag() == 1) && (bodyB->getTag() == 10)) || ((bodyB->getTag() == 1) && (bodyA->getTag() == 10)))
	{

		
		Tank* tank;
		BulletAbstract* bullet;

		if (bodyA->getTag() == 1)
		{
			tank = dynamic_cast<Tank*>(bodyA->getNode());
			bullet = dynamic_cast<BulletAbstract*>(bodyB->getNode());
		}
		else
		{
			tank = dynamic_cast<Tank*>(bodyB->getNode());
			bullet = dynamic_cast<BulletAbstract*>(bodyA->getNode());
		}
		if (bullet->getLifeTime() >= 1.97)
		{
			;// return false;
		}
		CCLOG("Contact bullets and tank");
		if (tank)
			tank->destroy();
		if (bullet)
			bullet->destroy();
	}
	return true;
	/*
	else
	{
		bodyA->setVelocity(Vec2(0, 0));
		bodyB->setVelocity(Vec2(0, 0));
		return true;
	}*/
}
    int main(int argc, char* argv[])
    {

      Tank sherman;

      sherman.setWheels( 24 ); 

      
      cout << "Tank has " << sherman.getWheels() << " wheels. " 
        << endl;

      return 0;
    }
Esempio n. 24
0
void Protocol::GenerateMap()
{
    struct PTankMap pmap;
    for(int i=0; i<scene->NumTankOnGame(); i++) {
        struct PTankData *ptdata = &(pmap.tanks[i]);
        Tank *tank = scene->getTank(i);
        ptdata->x = tank->pos().x();
        ptdata->y = tank->pos().y();
        ptdata->angle = tank->rotation();
        ptdata->id = i;
        ptdata->fire_on = tank->Action() & ACT_FIRE?1:0;
        if(tank->Action() & ACT_FIRE) {
            int x=0;
        }
        ptdata->move_up = tank->Action() & MOVE_UP?1:0;
        ptdata->move_left = tank->Action() & MOVE_LEFT?1:0;
        ptdata->move_right = tank->Action() & MOVE_RIGHT?1:0;
    }
    pmap.code = SEND_MAP;
    pmap.total_tank = scene->NumTankOnGame();

    const char *ch = (const char *) &pmap;
    QByteArray array(ch, sizeof(struct PTankMap));
    scene->gserver->BroadcastMessage(array);
}
Esempio n. 25
0
	void TankFactory::clearAll(){ //exception is player tank
		for (TankIterator t = tankList.begin(); t != tankList.end();){ //t shouldn't be increment in for loop, may cause program crashes.
				Tank* tank = *t;             

				if(tank->getType() == TANK_PLAYER){
					playerTank = NULL;
				}
				t++;
				destroyTank(tank);
				tankList.remove(tank);
		}

		//tankList.clear();
	}
Esempio n. 26
0
void FirstTick( Tank & self, World & world )
{
	for (double i = 0.0; i <= world.height(); i += self.height())
	{
		for (double j = 0.0; i <= world.width(); i += self.width())
		{
			c.push_back( Corner( i, j, -1.0) );
		}
	}

	c.push_back( Corner( 0.0, world.height(), 3 ) ) ;
	c.push_back( Corner( world.width(), 0.0, 3) );
	c.push_back( Corner( world.width(), world.height(), 3) );
	c.push_back( Corner( 0.0, 0.0, 3) );
}
Esempio n. 27
0
void gameTick(Tank& tan) {
	if (upPressed) {
		tan.accel(1);
	}
	if (downPressed) {
		tan.accel(-1);
	}
	if (leftPressed) {
		tan.rot(1);
	}
	if (rightPressed) {
		tan.rot(-1);
	}
	tan.state.x -= tan.state.v*sin(tan.state.h*(PI/180.0f));
	tan.state.y += tan.state.v*cos(tan.state.h*(PI/180.0f));
}
Esempio n. 28
0
void HydEngine::updateTanks()
{
    for (Node* node : network->nodes)
    {
    	if ( node->type() == Node::TANK )
        {
            Tank* tank = static_cast<Tank*>(node);
            tank->pastHead = tank->head;
            tank->pastVolume = tank->volume;
            tank->pastOutflow = tank->outflow;
            node->fixedGrade = true;
            tank->updateVolume(hydStep);
            tank->updateArea();
        }
    }
}
Esempio n. 29
0
void Updata()//更新界面信息
{
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
	int i;
	SetPos(53,0);
	cout<<"生命值:";
	SetPos(53,1);
	for(i=0;i<5;i++)
	{
		if(i<player.Life)
			cout<<"■";
		else
			cout<<" ";
	}
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_GREEN);
	SetPos(53,3);
	cout<<"移动速度:";
	SetPos(53,4);
	for(i=0;i<5;i++)
	{
		if(i<player.GetSpeed())
			cout<<"■";
		else
			cout<<" ";
	}
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_RED);
	SetPos(53,5);
	cout<<"火力:";
	SetPos(53,6);
	for(i=0;i<5;i++)
	{
		if(i<player.GetFire())
			cout<<"■";
		else
			cout<<" ";
	}
    SetPos(53,8);
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
	cout<<"杀敌数:"<<Kill;
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_RED);
	SetPos(53,9);
	cout<<"杀死红坦克:"<<KillRed;
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),FOREGROUND_INTENSITY| FOREGROUND_GREEN);
	SetPos(53,10);
	cout<<"杀死绿坦克:"<<KillGreen;

}
Esempio n. 30
0
void CollisionManager::CollideTankMine( Tank& tank, Mine& mine )
{
	MessageBeep(MB_ICONSTOP);
	tank.SetCoordinates( mine.GetCoordinates() );
	mine.Explode();
	mine.Damage(tank);
	mine.Die();
}