NOC – Week 10 – Yunyu Zhang(Samantha)

  1. Apply the raw a small fish figure that would follow a ball(fish food) whose position is decided by the position of clicking the mouse. Experiment with the x and y positions of the fish to make the heading direction to the ball correct and natural. 
  2. Use vector subtraction between the position of the fish and the position of the ball to get a new vector, whose magnitude is the distance between the fish and the ball. Through applying if statement that works to compare the value between this distance and a set value, the ball can be only displayed when the distance is larger than the set value, which realized the collision-vanish effect.
  3. Use sin() function to add a dynamic effect to the ball.
  4. Under function mousePressed(), add statements that work to change the size as well as the color of the ball. This makes the size and the color of the ball different every time the mouse is clicked, where its position would also change.
  5. Experiment with some of the values to make things look a bit more comfortable and natural and make the scene full-screen.

Leave a Reply