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
-
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:
The color is set toanimalImage.setColor(1, 0, 0, 1); // Red color (R, G, B, A)
(1, 0, 0, 1)
, which corresponds to a red tint with full opacity.
-
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:
This restores the animal image to its original color usinganimalImage.setColor(1, 1, 1, 1); // Reset to original color
(1, 1, 1, 1)
for full white with no tint.
Usage Flow
- When an animal image is clicked, the previously selected animal (if any) is reset to its default appearance using the
resetAnimalAppearance
method. - The last viewed animal is then highlighted by calling
highlightSelectedAnimal
, which applies a red color to the image.