Animal Highlighting Doc - UQcsse3200/2024-studio-2 GitHub Wiki

Overview

The Animal Highlighting feature provides visual feedback to the player by applying a red color to the selected animal image, making it easily distinguishable from the other animals in the roulette.

Methods Involved

  1. highlightSelectedAnimal(Image animalImage)

    • Highlights the last viewed animal by changing its color to red.
    • Parameters:
      • Image animalImage: The image of the animal that the player has selected.
    • Logic:
      animalImage.setColor(1, 0, 0, 1);  // Red color (R, G, B, A)
      
      The color is set to (1, 0, 0, 1), which corresponds to a red tint with full opacity.
  2. resetAnimalAppearance(Image animalImage)

    • Resets the appearance of the previously viewed animal, removing any applied tint or highlighting.
    • Parameters:
      • Image animalImage: The image of the previously viewed animal.
    • Logic:
      animalImage.setColor(1, 1, 1, 1);  // Reset to original color
      
      This restores the animal image to its original color using (1, 1, 1, 1) for full white with no tint.

Usage Flow

  1. When an animal image is clicked, the previously selected animal (if any) is reset to its default appearance using the resetAnimalAppearance method.
  2. The last viewed animal is then highlighted by calling highlightSelectedAnimal, which applies a red color to the image.

Image

Screenshot 2024-10-16 at 11 48 35 PM