Warning Component - UQcsse3200/2023-studio-3 GitHub Wiki
Description
The WarningComponent is responsible for briefly tracking a freshly spawned mob and displaying a flashing container over it for three seconds. This is meant to alert the user for an incoming mob and make the gameplay more interactive.
Functionality
The warning is displayed as an Image object. The initial Vector2 position is set using the mob's position, and a sequence of show() and hide() actions is stored in a SequenceAction object for the flashing effect, which is then stored in a ParallelAction variable to couple it with the moving action.
The moveTo Action is called to place the warning on the mob every time the WarningComponent gets updated by the WarningTask.
The convert_coordinates method is used to convert the grid coordinates to the map's coordinates to enable warning placement on a mob.
This component along with the Image are deleted using dispose() and Actions.removeActor() methods upon completion of the WarningTask.