Part A: A More Interesting Viewnder

Assignment One drew a simple viewnder. Update your code to draw a more interesting sh. Keep the window size size(640, 360) . The new viewnder (henceforth called VF2.0) should additionally have a black circle around the red crosshair, and twelve markers, drawn as small white circles, at equal intervals along the circumference of the circle. VF2.0 should be generated at random x coordinate, should appear from top of the display window, moving down until it disappears. The x coordinate at which it appears should be such that no part of VF2.0 is to the left of the left wall or to the right of the right wall.

The background and the dimensions of the viewnder should be reasonably close to the outcome shown above and the video.

The markers must be drawn using a meaningful loop

Part B: Hitting VF2.0 and aftermath

While VF2.0 is moving down, you can hit it with a mouse press. Scenarios

  • If the mouse is pressed within the inner grey circle, your shot is successful, the VF2.0 disappears and the speed of the next VF2.0 is higher than the current speed by a xed value.
  • If the mouse is pressed outside the inner circle but inside the outer circle (the area between the grey circle and the black outline of the bigger circle), your shot is unsuccessful, the VF2.0 disappears and the speed of the next VF2.0 is lower than the current speed by a xed value.
  • If the mouse is pressed outside the outer circle, the shot is irrelevant and the current VF2.0 keeps moving down.

Part C: Endgame

The aim of the game is to reach up to a certain speed, well call this win speed (WS). The game starts with VF2.0 moving down at an initial speed (call this IS), and the objective is to hit the inner circle of the VF2.0s to eventually reach WS (assumption is that WS > IS). If the hits are unsuccessful, the speed of VF2.0 decreases (lower bound should be IS, and the speed of VF2.0 should never go below IS). When the VF2.0 achieves a speed of WS, the game ends with a Congratulations message on the display window.

Part D: Logging tries and monitoring progress

An log about the number of hits (successful/ unsuccessful/ irrelevant) must be displayed on the screen as a sequence of N circle starting from the top left side of the display window, all but the last coloured grey. You need to show the outcome of only the latest hit by using a green circle for successful hit, red circle for unsuccessful hit, and black circle for irrelevant hit.

If the number of circles is such that after drawing M circles, the next circle would be outside the display window if drawn at the same y coordinate, the subsequent circles should be drawn on the next line (below the current y coordinate). Following is an example log where the last hit was unsuccessful. See image.

The logging of tries must be completed using a meaningful loop

There should also be a progress indicator in the form of a pie-chart, displayed on the bottom left side of the display window, as in the video. The proportion of pie-chart that is lled depends on the percentage of progress that has been made in the conquest to go from the initial speed to the win speed. For example, if initial speed is 4.0, win speed is 7.6, where the speed is increased by 0.3 every time a successful hit is made, and there have been 6 hits, all successful, then the player is 50% through the game. Thus half of the pie would be lled. After that lets say there are 3 hits all unsuccessful, then the net successful hits have become 6 - 3 = 3. Thus, now a quarter of the pie would be lled. The adjoining screenshot show that 10 net successful hits have been made where the hits required to win are 12. See image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.