Question
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.
- 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.
- 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.
- 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. )
- 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).
- 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started