CS代考 CS106 W22 – Assignment 05

CS106 W22 – Assignment 05
Due: Friday, February 11, 2022, 11:59 PM Assignment 5 is graded out of 30 marks.
Requirements and Grading You will create two sketches, A5_basic and A5_enhanced.
In A5_basic, you will implement as much required functionality as you can without any enhancements. Your goal is to match the video demonstration. This is the sketch the markers will evaluate for required functionality marks. Do this first.

Copyright By PowCoder代写 加微信 powcoder

In A5_enhanced, you can extend and deviate somewhat from the required functionality to show off your programming skill and design creativity. Do this second.
Required Functionality A5_basic: [ 20 marks]
In computer games you will sometimes see a vehicle on a terrain, and mountains in the background. See the following example: https://youtu.be/QODQw3sZUyU We are going t create a somewhat simplified version of a vehicle on a terrain. Ours looks like the following:
There is starter code at: https://openprocessing.org/sketch/1459977 You task is to mimic what you see in the video:
https://vault.cs.uwaterloo.ca/s/n2swsn9KWtzwCpQ
CS 106 | Winter 2022 | Assignment 05 | Page 1 of 4

In the video the green area represents mountains. They scroll by slowly. The black area represents a road. The road scrolls a bit more quickly than the green mountains. The blue rectangle represents the character in the game (perhaps a car or a “bad guy”). The red ball represents an obstacle that travels on the road and may hit the blue character. The starter code includes the green mountains. You may modify the code for the green mountains, but you don’t need to modify it.
You task is to mimic what you see in our video.
a) [ 4 marks ] Create a function drawGame(). Use that function to draw the black road and have it moving right to left at a faster speed than the green mountain. (See the video.)
[ 1 mark ] The road is black.
[ 1 mark ] The road moves right to left.
[ 1 mark ] The road move faster than the green mountains.
[ 1 mark ] noise() and beginShape/endShape are used to create the road.
Hint: Your code for the road in your function drawGame() will be very similiar to the code in drawBackgroundMountain(). You will need different variables for the green mountain and the road.
b) [ 4 marks ] In function drawGame(), put the blue rectangle at location 300 on the x-axis. The bottom of the blue rectangle must be slightly above the road. (See the video.).
Hint: Consider the code on slides 49-50 “BallOnNoiseyLine” in the “05 Randomness and Noise” pdf slides. However, in those slides the ball is moving and you want the blue rectangle to always be at 300.
c) [ 4 marks ] In the function drawGame(), draw a red ball that moves from left to right. The bottom of the ball touches the road.
Hint: Again, consider the code on slides 49-50 “BallOnNoiseyLine” in the “05 Randomness and Noise” pdf slides.
d) [ 4 marks ] In the function drawGame(), when any part of the ball is touching the blue rectangle, the blue rectangle changes colour.
Hint: This is a hit test.
e) [ 4 marks ] When the player presses the “J” or “j” key the blue rectangle jumps in the air for 2 seconds (2,000 milliseconds).
CS 106 | Winter 2022 | Assignment 05 | Page 2 of 4

• Hint: Use function keyPressed() and boolean variable that is true when the rectangle is jumping and false otherwise. Use a timer to keep the blue rectangle in the air for 2,000 milliseconds (i.e. 2 seconds) Don’t forget the millis() function.
[ 4 marks ] Coding Style and Efficiency
Coding style is evaluated in all sketches.
Follow the course coding style for whitespace and comments. Consult the “Code Style Guide” on LEARN.
1) [ 0.5 ] Include your name and student ID number at the beginning of your code.
2) [ 0.5 ] Comment your code appropriately. Avoid superfluous comments.
3) [ 0.5 ] Correctly and consistently indent your code blocks.
4) [ 0.5 ] Use correct inline spacing.
5) [ 0.5 ] Use good line spacing to chunk sections of your code.
6) [ 0.5 ] All variable names are meaningfully chosen.
7) [ 0.5 ] No variables are declared but not used.
8) [ 0.5 ] You may not use any functions or statements not covered in lecture or labs. This
includes, but is not limited to:
• No translate(), rotate(), or scale() functions.
[ 6 marks ] Functionality or Visual Design Enhancements
Once you have basic functionality working (the “correctness” requirements above), enhance the functionality or the visual design in a sketch called A6_enhanced.
In comments at the top of your code, you must document your enhancements so that the person grading knows what enhancements you made.
To get these 6 marks for enhancements you must clearly demonstrate your use of JavaScript p5 and/or your creativity. If it is not done you get 0, if it is minimally done you get 1-3 out of 6, and if it is well done you get 4-6 marks. For example, if you add a splash screen with only the words “press any key to continue” then you would get 1 out of 6. To get 6 out of 6 you must do much more such as adding a nice splash screen, improving the look of the game significantly, and adding a points systems whereby successful jump over the red ball gains points and each hit (where the red ball hits the blue rectangle) subtracts point(s). Another possibility is to add images to theme the game such as the images from previous examples including lamp, camel, and chest. It might look something like the following which is code I stared working on but then abandoned as it was getting to complicated for A5_basic. https://vault.cs.uwaterloo.ca/s/gLq4dQSrYjfn7j9
CS 106 | Winter 2022 | Assignment 05 | Page 3 of 4

Submitting
Use the template file in Word “CS106 Assignment Template” in LEARN (under Assignment 01) to create your Assignment 05 submission for your 2 sketches.
Then convert your Word file to pdf. Please ensure that your URLs are hot links. The TAs need to be able to click on each link in your pdf and go directly to your sketch.
So for example, don’t have a link like this: https://openprocessing.org/sketch/1050954
but rather have that link as a hot link as follows: https://openprocessing.org/sketch/1050954 Ensure that each URL you submit has its settings so that the access is as follows:
Submit that pdf file to the Assignment 05 dropbox on LEARN.
An example of how to do submit a Lab or Assignment sketch is shown in the following video from
Lab 0: https://vault.cs.uwaterloo.ca/s/MgPD3pBEMjmHQYz
CS 106 | Winter 2022 | Assignment 05 | Page 4 of 4

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com