20. Quiz C - Solar Jump

Solar Jump I

You will see a red dot and a black dot, both radius 10.

  • Randomly place a black dot. Randomize every time you run the code. It does not need the ability to move during a single run.

  • The red dot jumps to your mouse when you click.

  • Hit “d” to double the distance between the centers of the black dot and the red dot. The red dot should move directly away from the black dot in this motion.

  • Hit “s” to shrink the distance between the edges of the black dot and the red dot to be 30 pixels. The red dot should move directly toward/away from the black dot during this motion.

Solar Jump II

In addition to the actions above:

  • Hitting any other key moves the orange dot on top of the red dot.
  • When the red dot moves, the orange dot stays in its previous location. There is a line connecting the red dot to the orange dot.

Solar Jump II requires more than a single (x,y) coordinate for a model.

<div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;">
  <iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="allowfullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/N-B2Vsg2lFA?autoplay=0&controls=1&end=0&loop=0&mute=0&start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="Solar jump two demo video."
  ></iframe>
</div>
Last modified January 23, 2024: Linked videos, titled quiz. (79c31af)