• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Player函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: Player

Player Utils::getEntityById(int entityId) {
	DWORD base = *(DWORD*)(getEntityList() + (0x10 * entityId));
	if (!base)
		return Player(NULL);

	return Player(base);
}
开发者ID:dinizthiagobr,项目名称:simpleCSGOCheat,代码行数:7,代码来源:Utils.cpp


示例2:

TicTacToe::TicTacToe(int N, int numP) {
	_playAuto = true;
	//initialize NxN grid with blanks (-1)
	for(int i=0; i<N; i++) {
		_grid.push_back(vector<Cell>());
		for(int j=0; j<N; j++)
			_grid[i].push_back(Cell());
	}
	for(int i=0; i<numP; i++) {
		string input;
		cout << "Is player" << i << " human? (true/false):";
		cin >> input; 
		if(!input.compare("true")) {
			_vplayers.push_back(Player(i, true));
			_playAuto = false;
		}
		else {
			_vplayers.push_back(Player(i, false));
		}
	}
	_emptyCells = N*N;
	_gameUp = false;

	//_grid[0][0].setBlocked();
		
}	
开发者ID:atishbits,项目名称:101,代码行数:26,代码来源:tictactoe.back.cpp


示例3: Player

void ServerModel::MovePlayer(const MovementInfo& info)
{
   Player()->UpdateMovementInfo(info);

   // send to world model
   m_worldModel.UpdateObjectMovement(Player()->Id(), info);
}
开发者ID:vividos,项目名称:MultiplayerOnlineGame,代码行数:7,代码来源:ServerModel.cpp


示例4: window

Game::Game():
    window(sf::VideoMode(800, 600), "SFML works!"), gboard(&players),
    idPlayer(1), posClickedMouse(-1,-1)
{
    idPlayer = 1;
    players.push_back(Player(1,sf::Color(0,255,0) ));
    players.push_back(Player(2,sf::Color::Red));
}
开发者ID:slallement,项目名称:domnetwork,代码行数:8,代码来源:Game.cpp


示例5: Player

	Player Device::ready(Clip &clip, bool streaming)
	{
		if(impl_) {
			if(streaming) return Player(impl_->newStream(&clip), &clip);
			else return Player(impl_->newBuffer(&clip));
		}
		return Player();
	}
开发者ID:Emulyator,项目名称:gamecatapult,代码行数:8,代码来源:audio.cpp


示例6: vec2

void CAIball::OnCharacterSpawn(CCharacter *pChr)
{
	CAI::OnCharacterSpawn(pChr);
	m_PowerLevel = g_Config.m_SvBotLevel;
	m_WaypointDir = vec2(0, 0);
	Player()->SetRandomSkin();
	
	m_Team = Player()->GetTeam();
	m_Role = rand()%3;
}
开发者ID:Siile,项目名称:Ninslash,代码行数:10,代码来源:ball_ai.cpp


示例7: m_white

GameInfo::GameInfo(QRegExp& pattern, int offset)
: m_white(Player(pattern.cap(offset), pattern.cap(offset + 1).toInt()))
, m_black(Player(pattern.cap(offset + 2), pattern.cap(offset + 3).toInt()))
, m_rated(pattern.cap(offset + 4))
, m_type(pattern.cap(offset + 5))
, m_time(pattern.cap(offset + 6).toInt())
, m_increment(pattern.cap(offset + 7).toInt())
, m_game_num(-1) {
  m_variant = variantCode(m_type);
}
开发者ID:Axure,项目名称:tagua,代码行数:10,代码来源:gameinfo.cpp


示例8: LevelTest

LevelGUI::LevelGUI(string LevelName)
{
	Level LevelTest(LevelName);
	LevelTest.Load();

	RenderWindow window(VideoMode(1280, 720), "Platformer:" + LevelName);
	View view(Vector2f(0, 0), Vector2f(1280, 720)); //These numbers can be scaled to zoom it out

	Player Player(Player(LevelTest.PlayerSpawn->rect.getPosition(), Vector2f(64, 64), Color::Blue, &LevelTest));
	window.setFramerateLimit(60);

	while (window.isOpen())
	{
		Event event;
		while (window.pollEvent(event)) //If theres any event that is supposed to close the window, do that and deallocate everything.
		{
			if (event.type == Event::Closed)
			{
				cout << "Closing...\n";
				//LevelTest.Save();
				//cout << "Successfully saved level.\n";
				window.close();
				cout << "Successfully closed window.\n";
				goto stop;
			}
			else if (event.type == sf::Event::MouseWheelMoved)
			{
				if (event.mouseWheel.delta > 0)
				{
					view.zoom(0.7f);
					cout << "Zooming in... \n";
				}
				else if (event.mouseWheel.delta < 0)
				{
					view.zoom(1.3f);
					cout << "Zooming out... \n";
				}
			}
		}

		Player.Move(&view); //HOLY SHIT SO MANY ADDRESSES
		window.clear(Color::White); //Make background white
		Player.Update();  //Update the coordinates of Player
		window.setView(view); //Has to be called every frame I read somewhere on the SFML tutorials
		LevelTest.Draw(&window); //"Draws" all of the blocks on the window
		window.draw(Player.rect); //Draw player
		view.setCenter(Vector2f(Player.rect.getPosition().x + ((Player.rect.getSize().x) / 2), Player.rect.getPosition().y + (Player.rect.getSize().y) / 2) ); //Centers camera on player


		window.display(); 
	}
	stop:
	cout << "Successfully exited this levelGUI.\n";
}
开发者ID:brianhoy,项目名称:Platformer,代码行数:54,代码来源:LevelGUI.cpp


示例9: TEST_F

TEST_F(TeeHistorian, TickImplicitTwoTicks)
{
	const unsigned char EXPECTED[] = {
		0x42, 0x00, 0x01, 0x02, // PLAYER_NEW cid=0 x=1 y=2
		0x00, 0x01, 0x40, // PLAYER cid=0 dx=1 dy=-1
		0x40, // FINISH
	};
	Tick(1); Player(0, 1, 2);
	Tick(2); Player(0, 2, 1);
	Finish();
	Expect(EXPECTED, sizeof(EXPECTED));
}
开发者ID:Laxa,项目名称:ddnet,代码行数:12,代码来源:teehistorian.cpp


示例10: Player

//Funcion clear gamestate
void MainGame::Clear()
{
	arbiter = false;
	aithinking = false;
	mode = none;
	player1 = Player(human, blue);
	player2 = Player(human, red);
	unsaved = false;
	currentmove = 0;
	currentmaxmove = 0;
	gamehistory.vhistory.Clear();	
}
开发者ID:ShadowswordPL,项目名称:Diaballik,代码行数:13,代码来源:MainGame.cpp


示例11: HeadToMovingDirection

void CAIball::DoBehavior()
{
	// reset jump and attack
	if (Player()->GetCharacter()->GetCore().m_JetpackPower < 10 || Player()->GetCharacter()->GetCore().m_Jetpack == 0)
		m_Jump = 0;
	
	m_Attack = 0;

	HeadToMovingDirection();
	
	if (Player()->GetCharacter()->GetWeaponType() != WEAPON_NONE)
	{
		SeekClosestEnemyInSight();
		
		// if we see a player
		if (m_EnemiesInSight > 0)
			ShootAtClosestEnemy();
	}
	
	
	if (!GameServer()->m_pController->m_pBall)
	{
		m_ReactionTime = 2;
		return;
	}
	
	vec2 BallPos = GameServer()->m_pController->m_pBall->m_Pos+vec2(0, -20);
	
	if (m_Role == 0)
	{
		if (distance(m_Pos, m_aGoalPos[m_Team]) < 150)
			m_TargetPos = BallPos;
		else
			m_TargetPos = (BallPos+m_aGoalPos[m_Team])/2;
	}
	else if (m_Role == 1)
		m_TargetPos = BallPos - normalize(m_aGoalPos[!m_Team]-BallPos)*frandom()*300;
	else
		m_TargetPos = BallPos;
	
	
	if (Player()->GetCharacter()->GetWeaponType() == WEAPON_NONE)
		FindWeapon();
	
	m_WaypointPos = m_TargetPos;
	MoveTowardsWaypoint(false);
	
	if (frandom()*100.0f < 0.3f)
		m_Role = rand()%3;
	
	m_ReactionTime = 2;
}
开发者ID:Siile,项目名称:Ninslash,代码行数:52,代码来源:ball_ai.cpp


示例12: CheckAITiles

void CAIBomber::DoBehavior()
{
	// reset jump and attack
	m_Jump = 0;
	m_Attack = 0;
	
	CheckAITiles();
	SeekPlayer();

	
	if (m_PlayerSpotCount > 0)
	{
		m_TargetTimer = 0;
	
		// on "first" sight
		if (m_PlayerSpotCount == 1 && m_BombTimer == 0)
		{
			Player()->GetCharacter()->SetEmoteFor(EMOTE_HAPPY, 1200, 1200);
			GameServer()->SendEmoticon(Player()->GetCID(), EMOTICON_HEARTS);
		}

		MoveTowardsPlayer(40);
		JumpIfPlayerIsAbove();
		
		m_Direction = m_PlayerDirection;
		
	
		if (m_BombTimer == 0)
		{
			if (m_PlayerDistance < 200)
			{
				m_BombTimer = 60;
				
				Player()->GetCharacter()->SetEmoteFor(EMOTE_HAPPY, 1200, 1200);
				GameServer()->SendEmoticon(Player()->GetCID(), EMOTICON_DEVILTEE);
				GameServer()->CreateSound(m_Pos, SOUND_PLAYER_PAIN_LONG);
			}
		}

		
		if (m_Pos.y < m_PlayerPos.y)
			m_Jump = 0;
	}
	
	Unstuck();
	HeadToMovingDirection();
	
	// next reaction in
	m_ReactionTime = 6 + frandom()*3;
	
}
开发者ID:Schwertspize,项目名称:KillingFloor,代码行数:51,代码来源:bomber.cpp


示例13:

GameLogic::GameLogic(const std::vector<int32_t> &playerIds) {
  player1_ = playerIds[0];
  player2_ = playerIds[1];
  winner_ = std::to_string(kNoWinner);
  hasFinished_ = false;
  for (int32_t i = 0; i < kWidth; ++i) {
    for (int32_t j = 0; j < kHeight; ++j) {
      field_[i][j] = kEmpty;
    }
  }
  // two players
  for (size_t i = 0; i < 2; ++i) {
    worldModel_.players.push_back(Player());
    for (size_t j = 0; j < kpInit[i].size(); j++) {
      Coordinate pos;
      pos.x = kpInit[i][j].first;
      pos.y = kpInit[i][j].second;
      field_[pos.x][pos.y] = (i==0 ? playerIds[0] : playerIds[1]);
      worldModel_.players[i].body.push_back(pos);
    }
  }
  std::vector<Command> moveList;
  moveList_.push_back(moveList);
  moveList_.push_back(moveList);
  updateMoveList_();
}
开发者ID:matheuscamargo,项目名称:Mjollnir,代码行数:26,代码来源:GameLogic.cpp


示例14: RECEIVE

RECEIVE(JOIN, id, msg, reliable)
{
	Player::Id pid = (long) msg[2];
	unsigned char team = (long) msg[3];
	
	if (pid == game.player->id)
	{
		// Connection complete, do stuff
	}
	else
	{
		// Other player joined
		game.topId = MAX(game.topId,pid) + 1;
		ObjectHandle player = Player(pid, team, msg[4]);
		game.root->children.insert(player);
		game.players[pid] = player;
		nodes[(long) msg[1]] = pid;
	}
	
	long redID = INT_MAX - 'a';
	long blueID = INT_MAX - 'b';
	
	if (game.players.count(redID) && (team == 'a'))
		game.world->terrain->Reassign(redID, pid);
	
	if (game.players.count(blueID) && (team == 'b'))
		game.world->terrain->Reassign(blueID, pid);
}
开发者ID:FerryT,项目名称:OGO-2.3,代码行数:28,代码来源:netcode.cpp


示例15: Player

//Constructor
FightGame::FightGame(std::string n1, std::string n2)
{
  players[0] = Player(this, n1);
  players[1] = Player(this, n2);
  players[0].changeState(Idle::Instance()->getStateID());
  players[1].changeState(Idle::Instance()->getStateID());
  
  //Make sure the states are registered
  Idle::Instance();
  AttackUp::Instance();
  AttackMid::Instance();
  AttackLow::Instance();
  DefendUp::Instance();
  DefendMid::Instance();
  DefendLow::Instance();
}
开发者ID:acolletti,项目名称:cs292,代码行数:17,代码来源:FightGame.cpp


示例16: getShipTypeCount

bool BaseAI::startTurn()
{
  static bool initialized = false;
  int count = 0;
  count = getShipTypeCount(c);
  shipTypes.clear();
  shipTypes.resize(count);
  for(int i = 0; i < count; i++)
  {
    shipTypes[i] = ShipType(getShipType(c, i));
  }

  count = getPlayerCount(c);
  players.clear();
  players.resize(count);
  for(int i = 0; i < count; i++)
  {
    players[i] = Player(getPlayer(c, i));
  }

  count = getShipCount(c);
  ships.clear();
  ships.resize(count);
  for(int i = 0; i < count; i++)
  {
    ships[i] = Ship(getShip(c, i));
  }

  if(!initialized)
  {
    initialized = true;
    init();
  }
  return run();
}
开发者ID:cherez,项目名称:the-machine,代码行数:35,代码来源:BaseAI.cpp


示例17: CLaser

void CMod_Weapon_Laser::CreateProjectile(vec2 Pos, vec2 Direction)
{
	new CLaser(GameWorld(), Pos, Direction, GameServer()->Tuning()->m_LaserReach, Player()->GetCID());
	
	CModAPI_WorldEvent_Sound(GameServer(), WorldID())
		.Send(Character()->GetPos(), SOUND_LASER_FIRE);
}
开发者ID:teeworlds-modapi,项目名称:mod-target,代码行数:7,代码来源:laser.cpp


示例18: string

Player::Player(): GameAsset 
(
  string("shaders/hello-gl.v.glsl"),
  string("shaders/hello-gl.f.glsl"))
{
  Player(0, 0, 0);
}
开发者ID:Cecaro,项目名称:RobotEscape,代码行数:7,代码来源:Player.cpp


示例19: stripResponseHeader

Status StatusParser::parse(QString data) {
    data = stripResponseHeader(data);
    QStringList playerList = data.split("\n");

    QString variableData = playerList.first();
    playerList.removeFirst();
    QStringList variableList = variableData.split("\\", QString::SkipEmptyParts);
    QStringListIterator it(variableList);
    Status status;
    while (it.hasNext()) {
        QString key = it.next();
        if(it.hasNext()) {
            QString value = it.next();
            status.variables.insert(key, value);
        }
    }

    QStringListIterator itP(playerList);
    while (itP.hasNext()) {
        QString line = itP.next();
        QStringList playerData = line.split(" ");
        if(playerData.size() >= 3) {
            QString playerName = QStringList(playerData.mid(2)).join(" ");
            playerName.chop(1); // remove first "
            playerName.remove(0, 1); // remove last "
            status.players.append(std::move(Player(playerName,
                                                   playerData[0].toInt(),
                                                   playerData[1].toInt())));
        }
    }

    return status;
}
开发者ID:M-itch,项目名称:qtercon,代码行数:33,代码来源:statusparser.cpp


示例20: switch

void MainMenuState::makeChoicePlayers()
{
    int choice = State::promptInteger();
    switch (choice) {
        case 1:
            m_players.push_back(Player(m_playerActual++));
            if (m_playerActual > m_nbPlayers) {
                // On a entré tous les joueurs
                m_subState = SUB_STATE::BOARD_SIZE;
            }
            break;
        case 2:
            m_error << "Desole, mais l'IA n'est pas encore implementee.";
            break;
        case 3:
            if (m_playerActual == 1) {
                m_subState = SUB_STATE::PLAY;
            } else {
                m_playerActual--;
                m_players.pop_back();
            }
            break;
        case -1:
        default:
            m_error << "Veuillez taper 1, 2 ou 3.";
    }
}
开发者ID:Ioni14,项目名称:quoridor,代码行数:27,代码来源:MainMenuState.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PlayerDumpWriter函数代码示例发布时间:2022-05-30
下一篇:
C++ PlayTone函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap