本文整理汇总了C++中Player函数的典型用法代码示例。如果您正苦于以下问题:C++ Player函数的具体用法?C++ Player怎么用?C++ Player使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Player函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Player
Player Utils::getEntityById(int entityId) {
DWORD base = *(DWORD*)(getEntityList() + (0x10 * entityId));
if (!base)
return Player(NULL);
return Player(base);
}
示例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();
}
示例3: Player
void ServerModel::MovePlayer(const MovementInfo& info)
{
Player()->UpdateMovementInfo(info);
// send to world model
m_worldModel.UpdateObjectMovement(Player()->Id(), info);
}
示例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));
}
示例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();
}
示例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;
}
示例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);
}
示例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";
}
示例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));
}
示例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();
}
示例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;
}
示例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;
}
示例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_();
}
示例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);
}
示例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();
}