Assignment two drew a viewfinder version 2 (VF2.0) containing markers along the circumference, drawn using a loop.
You need to update the viewfinder design such that the new viewfinder (VF3.0) now has a a structure like spokes in bicycles. The viewfinder should resemble the sample provided here. The spokes must be drawn using a loop.
Diameter of the inner circle (no border, semi-transparent black fill) of each viewfinder should be between 30 and 60 (inclusive) such that different viewfinders have different sizes. Diameter of the outer circle (black border, no fill) is twice that of the inner circle. Six white equidistant spokes with stroke weight 5 should be drawn.
As your main task, you are required to create multiple viewfinders, using a loop (no marks if a purposeful loop is not used). These viewfinders must satisfy following criteria.
HIT If a viewfinder is hit within the inner circle, it is be regenerated with a 10% higher speed, and other viewfinder speeds should also increase by 10%.
MISHIT If a viewfinder is hit outside the inner circle but inside the outer circle, it should be regenerated with a 10% lower speed, and speed of all other viewfinders should also increase by 10%.
Now the fun part - since a single hit can actually hit zero, one, or more viewfinders (some inside, others outside), the above two rules should be observed for each viewfinder sequentially. (They should be observed for viewfinder 1, then viewfinder 2, and so on till the last viewfinder).
Let’s say you hit viewfinder 1 and 4 inside the inner circle and viewfinder 3 outside the inner circle but inside the outer circle with a single mouse press. Because you hit viewfinder 1, speed of all viewfinders increases by 10%. Then, because you mishit viewfinder 3, speed of all viewfinders decreases by 10% (Note that this reduction of speed is on the increased speed owing to hitting viewfinder 1). Then, because you hit viewfinder 4, speed of all viewfinders increases by 10% (Note that this increase in speed is on the decreased speed owing to mishitting viewfinder 3).
Each hit contributes 10% to the percentage mission accomplished, and each mishit takes away 10% from it (bounded on the lower side by 0, that is even if you have mishits once mission accomplished percentage is 0, it doesn’t decrease beyond that). The change in percentage is computed once for every mouse press. Let’s say you hit viewfinder 1 and 4 inside the inner circle and viewfinder 3 outside the inner circle but inside the outer circle with a single mouse press. The net change in percentage mission accomplished is (+2*10-1*10 = +10). Once the percentage reaches 100%, the game is over.
(20%) You are required to keep a track of the number of viewfinders hit, and the number of viewfinders mishit during the duration of the game. For each hit viewfinder, a green circle is drawn, and for each mishit viewfinder, a red circle. For each miss (neither hit nor mishit) during a mouse press, a black circle is drawn. The order of the circles should be in the order of these events happening. As in assignment 2, if there is not enough space on a row for all circles, the rest of the circles should be drawn on the next row, starting from the left again.
Half of these 20% marks are for doing it right, and half of the marks are for filling the correct colours in the circles WITHOUT using conditions. This should provide an adequate challenge for students striving for high distinction.
(5%) A pie representing percentage mission accomplished should be drawn on the bottom left of the display window. Full pie represents 100%, half pie represents 50% and so on