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


C++ screen::pause方法代码示例

本文整理汇总了C++中screen::pause方法的典型用法代码示例。如果您正苦于以下问题:C++ screen::pause方法的具体用法?C++ screen::pause怎么用?C++ screen::pause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在screen的用法示例。


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

示例1: reward

	// Function that displays a screen for the experience and levels
	// gained from the previous battle
	void reward()
	{
		display.Clear();
		cout << "Previous Level: " << Play1.level << " Previous XP: " << Play1.experience << endl;
		cout << "Gained " << Enem1.xpvalue << " experience!!!" << endl;
		Play1.setXP(Enem1.xpvalue);
		cout << endl << "Current Experience: " << Play1.experience << endl;
		display.pause();
	};
开发者ID:cepsbow,项目名称:ASBG,代码行数:11,代码来源:asbg.cpp

示例2: battle

	// CurGame's primary method, this encapsulates the entire battle
	// routine, the routine ends as soon as the enemy or the player
	// reach 0 or less hit points. Returns a boolean to determine if
	// the player died during combat or an attempt to run away.
	bool battle()
	{
		// Initialize battle()'s variables to NULL
		// maxhp stores the players original max health so the value
		// can be restored if the player survives the encounter
		int select=0, maxhp=Play1.health;
		bool playDeath=false, enemDeath=false;
		
		// Keep fighting until the player runs or someone dies
		do
		{
			// Clear the display to draw the next frame
			display.Clear();
			
			// Display the battle screen
			select = battleMenu();
			
			// Check which option was chosen
			// The enemy is implemented without AI and will follow
			// suit with the player, a simple AI would evaluate 
			// which of its stats are greater than the player's
			switch( select )
			{
				// Strength based attack
				case 1:
					enemDeath = playAttRound(1);
					playDeath = enemAttRound(1);
					display.pause();
					break;
				// Dexterity based attack
				case 2:
					enemDeath = playAttRound(2);
					playDeath = enemAttRound(2);
					display.pause();
					break;
				// Spellcasting (Intelligence based attack)
				case 3:
					enemDeath = playAttRound(3);
					playDeath = enemAttRound(3);
					display.pause();
					break;
				// Attempt to run away from combat	
				case 4:
					// If they successfully run away
					if ( run() )
					{
						Enem1.xpvalue = 0;
						cout << "\nYou ran away successfully!!!\n";
						display.pause();
						return true;
					}
					// Or else the enemy gets a free attack on the player
					else
					{
						cout << "\nYou failed to get away, the enemy hits you!\n";
						playDeath = enemAttRound( randnum(3, 127) );
						display.pause();
					}
					break;
				// Let the user know their input is invalid	
				default:
					cout << "\nPlease enter a correct choice!!!\n";
                    display.pause();
					break;
			}

			// Check to see if either or both of our competitors have died
			if( playDeath && enemDeath )
			{
				cout << "\n\nYou simultaneously strike each other fatally!!! A true warrior's death...\n";
				display.pause();
				return false;
			}
			else if( playDeath && !enemDeath )
			{
				cout << "\n\nYou died!!!\n";
				display.pause();
				return false;
			}
			
			else if( enemDeath && !playDeath )
			{
				cout << "\n\nYou have slain the " << Enem1.ename << "!!!\n";
				// Reset the players health to maximum after combat
				Play1.health=maxhp;
				display.pause();
				return true;
			}
	
		}while( !playDeath && !enemDeath );
	};
开发者ID:cepsbow,项目名称:ASBG,代码行数:95,代码来源:asbg.cpp


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