Question: a game will be created that requires the spaceship to be own through narrow passages or gates from one dimension to nother. Prepare for this
a game will be created that requires the spaceship to be own through narrow passages or "gates" from one "dimension" to nother. Prepare for this be creating random dimensions, each with passage or gate shown on the right. lefine a function void newDimension () which will create a ew random dimension, storing all of the relevant data in a set of tate variables (about 10 of them). - The dimension should have a random dark background colour. You can store a colour in a single int variable, using the built-in function color ( (r, g, b) ) to convert the three separate values for red, green, and blue (all 0 to 255) into a single int value. You can endure that the colour is dark by generating random values that never get too large. - The passage to the next dimension should be a simple pair of white rectangles, close together, drawn on an edge of the canvas, as shown in the figure. Use suitable constants to define the shape of the rectangles, and how far apart they are. The spaceship should be able to fly between them, without touching them, but it shouldn't be too easy to do. - In the first dimension, when the program starts, the passage should be on either the top or bottom edge of the canvas (at random). In the next dimension, it should be on either the left or right edge (at random). The next time, it should again be on the top or bottom, and this alternation should repeat. You must use two boolean variables to control which edge the passage is on. One should control whether it is on the top/bottom or left/right, and this one should change every time newDimension () is called. The other one should control whether it's on the top or left, or on the bottom or right. This one should be random. - Choose a random position for the passage, but not too close to any corner. The distance from the passage to any corner should never be smaller than the length of the passage (the long side of the rectangles). This is so that the spaceship will never fly through a passage straight into a wall in the next dimension. That wouldn't be a very fair game.define the function drawPassage that uses information from newDimension to draw the gates.U have to use processing to code this
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
