void CGameControllerCSBB::RoundWinLose() { m_SkipWinBroadcast = false; int score = CheckLose(true); // give points and stuff if (score == TERRORISTS_WIN) { //if (!m_SkipWinBroadcast) // GameServer()->SendBroadcast("Terrorists score", -1, true); GameServer()->CreateSoundGlobal(SOUND_CTF_CAPTURE, -1); m_aTeamscore[TEAM_RED]++; RoundRewards(TEAM_RED); EndBaseRound(); } else if (score == COUNTERTERRORISTS_WIN) { //if (!m_SkipWinBroadcast) // GameServer()->SendBroadcast("Counter-terrorists score", -1, true); GameServer()->CreateSoundGlobal(SOUND_CTF_CAPTURE, -1); m_aTeamscore[TEAM_BLUE]++; RoundRewards(TEAM_BLUE); EndBaseRound(); } }
bool Ball::Update(std::vector <std::string>& levelData, glm::vec2 startPos, glm::vec2 endPos, std::vector <glm::vec2>& bricksPosition, std::vector <glm::vec2>& upgradesPosition) { m_position += m_direction * m_speed; // Colliding with player if (CollideWithPlayer(startPos, endPos)) { return true; } // Colliding with level if (CollideWithLevel(levelData)) { return true; } // Colliding with bricks if (CollideWithBricks(levelData, bricksPosition)) { m_points += 10; return true; } //Colliding with upgrades is in MainGame -> GameLoop() // Check if ball is under player if (CheckLose(startPos)) { return false; } return true; }
update_status ModulePlayer::PreUpdate(){ if (mystate == PREUPDATE){ LoseCondition = CheckLose(); App->spheres->AddSphere(App->spheres->spheres[Random], 73 * SCREEN_SIZE, 184 * SCREEN_SIZE, COLLIDER_SPHERE_LEFT); mystate = UPDATE; } return update_status::UPDATE_CONTINUE; }
int CheckStatus(int b[9]) { int status; status=CheckWin(b); if(status==1) { return 1; } status=CheckLose(b); if(status==(-1)) { return -1; } status=CheckDraw(b); if(status==1) { return 0; } return 20; }
bool Scene_Battle_Rpg2k::CheckResultConditions() { return CheckLose() || CheckWin() || CheckAbort() || CheckFlee(); }
void main() { clrscr(); int pos; char choice; int legal; cout<<"Do You Want Me to Start?\nChoice(y/n):"; //Who plays the first move? cin>>choice; DisplayBoard(a); switch(choice) { case 'y': { while(move<5) //First one to move would make a maximum of 5 moves { pos=MiniMax(a); a[pos]=2; DisplayBoard(a); if(CheckWin(a)) { DisplayBoard(a); cout<<"\n\nYou lost!"; delay(5000); break; } else if(CheckDraw(a)) { DisplayBoard(a); cout<<"\n\nIts Draw!"; delay(5000); break; } enterAgain1: cout<<"\n\nEnter position(0-8):"; cin>>pos; legal=CheckLegal(a,pos); if(legal==0) { cout<<"\nInvalid Move!"; goto enterAgain1; } a[pos]=1; DisplayBoard(a); if(CheckLose(a)) { DisplayBoard(a); cout<<"\n\nYou won!"; delay(5000); break; } else if(CheckDraw(a)) { DisplayBoard(a); cout<<"\n\nIts Draw!"; delay(5000); break; } move++; } break; } case 'n': { while(move<5) { DisplayBoard(a); enterAgain2: cout<<"\n\nEnter position(0-8):"; cin>>pos; legal=CheckLegal(a,pos); if(legal==0) { cout<<"\nInvalid Move!"; goto enterAgain2; } a[pos]=1; DisplayBoard(a); if(CheckLose(a)) { DisplayBoard(a); cout<<"\n\nYou won!"; delay(5000); break; } else if(CheckDraw(a)) { DisplayBoard(a); cout<<"\n\nIts Draw!"; delay(5000); break; } pos=MiniMax(a); a[pos]=2; cout<<"\n\t"<<pos; DisplayBoard(a); if(CheckWin(a)) { DisplayBoard(a); cout<<"\n\nYou lost!"; delay(5000); break; } else if(CheckDraw(a)) { DisplayBoard(a); cout<<"\n\nIts Draw!"; delay(5000); break; } move++; } break; } default: { break; } } }