Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Name of the game Swap, Steal and Unwrap Gift Game create a 2D game using processing. In this game, there are three players (Player 1,

Name of the game "Swap, Steal and Unwrap Gift Game"
create a 2D game using processing.

In this game, there are three players (Player 1, Player 2 & Player 3). Each player has their respective playing areas that initially contains three gifts placed at a random location within the playing area. The players take turns to roll digital dice. The value on the dice will determine if each player swap and open their gift with another player, steal and unwrap/open another player's gift or unwrap one of their gifts. The game ends when all the gifts of any of the players have been unwrapped.

The game has the following components:

1. Three playing areas- These are represented by three vertical rectangles of different colours on the screen size of 600 wide x 600 high. In the video, these three vertical rectangles are filled with red, purple, and green colours. Though the players playing area is represented as three vertical rectangles.

  1. The shape of the gifts: use a rectangle (round corner) as a shape for the gifts. Player 1 gifts are filled with green colour, Player 2 gifts are filled with yellow colour and Player 3 gifts are filled with purple colour.
  2. Position of the gifts- Each players gifts are placed at random locations within the players playing area. must use arrays to store the random locations of the gifts. (use one array per player).

4. Function to display the gifts the code must use a function that takes an array as an input/parameter (pass the array which stores the random location of the gift from step 3 above). The function iterate through the input array to draw the gift/shapes on the respective players playing area. No two gifts should overlap each other (validate the random locations of each gift to make sure they dont overlap each other).

5. Function to create Dice and Roll operation the code must use a function to create a dice and display a random number between 1-6 (inclusive of 6).

6. Help Text Help text is used at the top of the screen, which displays instructions on how to play a game like clicking the dice to start playing or display player names etc. In addition to the above help text, must display the gift numbers of each respective player's gifts. P1G1, P1G2, P1G3 as the text for three different gifts of Player 1 and P2G1, P2G2, P2G3 for gifts of Player 2 and same for Player 3.

Game Dynamics:

1. Choose any player to start the game and each player takes a turn by clicking on the dice (Make sure, the click is validated only on the area of the dice). The player takes action based on the value/roll on the dice. The player who is clicking the dice gets to choose one of the following steps based on the number on the dice:

I.

Roll 1 (Gift Swap & unwrap from Left-hand side player) - Value 1 on the dice will enable the player to swap any one of the wrapped gifts from the player on his LEFT- Hand side. Both of the swapped gifts should be opened for both players. Player 1 will swap and unwrap a gift from player 3 which is on the left-hand side of player 1. Likewise, Player 3 will swap and unwrap a gift from Player 2, and player 2 will swap and unwrap a gift from Player1. Unwrapped/open gifts cant be swapped. You can swap the gifts either by clicking on the gifts or swap the gifts in order (like gift1, gift2, gift3 ) if they are wrapped. The code must use a function to show this LEFT swap & unwrap action.

  1. Roll 2 (Gift Swap & unwrap from Right-hand side player) - Value 2 on the dice will enable the player to swap any one of the wrapped gifts from the player on his RIGHT- Hand side. Both of the swapped gifts should be opened for both players. Player 1 will swap and unwrap a gift from player 2 which is on the right-hand side of player 1. Likewise, Player 3 will swap and unwrap a gift from Player 1, and player 2 will swap and unwrap a gift from Player3. Unwrapped/open gifts cant be swapped. You can swap the gifts either by clicking on the gifts or swap the gifts in order (like gift1, gift2, gift3 ) if they are wrapped. The code must use a function to show this RIGHT swap & unwrap action.

(Hint- You can use one function for Gift Swap Left hand side and Gift Swap Right- hand side functionality . The function takes two arrays as parameters/ inputs and iterate through the elements of the array to find the coordinates that needs a swap and then swap the corresponding array elements/coordinates. )

  1. Roll 3 or 4 (Steal and Unwrap function) the code must use a function to steal one of the wrapped gifts from any other player in any order and unwrap it. You can steal a gift from the other player by clicking on the gift (area of the shape) and placing that gift randomly on your playing area. You can't steal the unwrapped gift of the other player or you can't steal if the other player has only one gift left (after all we don't want players to go without a gift).

  1. Roll 5 or 6 (Unwrap/ Open gift function) the code must use a function to unwrap/ open the gift, the player clicks on the gift, the click will change the colour/ fill of the gift.

2. Game end- The game ends as soon as the final gift is unwrapped for any one player.

the images below are samples.
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
0 Player 1 Player2 Player3 P262 P1G1 P2G1 P3G2 P2G3 P361 P1G2 P3G3 P1G3 2 Player1 Player2 Playera P262 P3G1 G2 P261 P2G3 P1G1 P1G2 P3G3 P1G3 Player 1 Player2 Playera P262 P3G1 P362 P261 P2G3 P1G1 P1G2 P3G3 P1G3 Game Over Players Player2 Playera P262 P3G1 G2 P261 P2G3 P1G1 P1G2 P3G3 P1G3 Game Over Player1 Player2 Playera P262 P361 P3G2 P261 P2G3 P1G1 P1G2 P3G3 PIGN 0 Player 1 Player2 Player3 P262 P1G1 P2G1 P3G2 P2G3 P361 P1G2 P3G3 P1G3 2 Player1 Player2 Playera P262 P3G1 G2 P261 P2G3 P1G1 P1G2 P3G3 P1G3 Player 1 Player2 Playera P262 P3G1 P362 P261 P2G3 P1G1 P1G2 P3G3 P1G3 Game Over Players Player2 Playera P262 P3G1 G2 P261 P2G3 P1G1 P1G2 P3G3 P1G3 Game Over Player1 Player2 Playera P262 P361 P3G2 P261 P2G3 P1G1 P1G2 P3G3 PIGN

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

Students also viewed these Databases questions