WikiWar: Multiplayer

I have been working on a multiplayer mode for the app WikiWar. We decided that a “pass and play” mode could be added into the game quite easily. Its base is still the same as a normal mode but there is some more stuff added. Before the game starts each player will get to select a wikipedia page from a lot of options. Player One will select the starting point and Player Two will select the end point. The game will then start.

First Player One will play through the game. When they reach the end point, the game will reset and Player Two will get to play through the game. A Popup box appears informing Player One to hand over the device. Each score is saved and then checks which is higher. The Activity that runs when a game ends now will display the winner.

private void showPopUp() {

AlertDialog.Builder helpBuilder = new AlertDialog.Builder(this);
helpBuilder.setTitle("Round Over");
helpBuilder.setMessage("Pass the device to Player Two");
helpBuilder.setPositiveButton("Ok",
new DialogInterface.OnClickListener() {

public void onClick(DialogInterface dialog, int which) {
stack.clear();
stack.push(startPoint);

loadWebView();
}
});

// Remember, create doesn't show the dialog
AlertDialog helpDialog = helpBuilder.create();
helpDialog.show();
}

 

if(url.equals(endPoint))
			{
				if(playerOne)
				{
					playerOne = false;
					countP1 = count;
					count = 0;
					current = startPoint;
					showPopUp();
				}
				else
				{
					String winner;
					countText.setText("You win");
					countP2 = count;
					if(countP1 > countP2)
					{
						winner = "Player One";
					}
					else if (countP2 > countP1)
					{
						winner = "Player Two";
					} else
					{
						winner = "NO ONE!! It's a draw!";
					}

					Intent intent = new Intent(MultiActivity.this, WinActivity.class);
					intent.putExtra("winner", winner);
					intent.putExtra("single", false);
					System.out.println("Working4");
	        		startActivity(intent);
				}

			}
Advertisements
Tagged , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: