Quick‐Time Events - UQcsse3200/2024-studio-2 GitHub Wiki

Quick-Time Events

Overview

Quick-time events are an important part of combat where a player is capable of hitting a sleeping enemy multiple times during one turn (see the Combat System for more details). This, however, is only possible if a player is able to pass the quick-time events.

A quick-time event is characterised as an event which requires the user to press an input within a small window of time. It should be made obvious to the user when this small window of time is where they must press an input.

Animation

The start of the quick-time event is advertised by a blue paw in the foreground which is super-imposed atop a smaller cyan one in the background. The blue paw begins by rotating anti-clocking about a pivot point. As it rotates, the size of the paw also shrinks. When the animation stops, the blue paw completely overlaps the static cyan one such that the background image is no longer visible. The small window of time in which the two paws are overlapping is what indicates to the user when they are required to press an input.

The quick-time event animation

Required input

The input that must be supplied by the user is the W key on the keyboard. This is implied to the user through the use of the "upwards-facing" background paw asset. If another type of key input is required of the user, such as A or D, then the paw image will point in that direction to indicate this.

Processing input

Depending on when the user presses the key during the quick-time event animation, one of three outcomes are possible:

  1. If the response is too slow (after the time window), then the background asset turns blue.

  2. If the response is too fast (before the time window), then the background asset turns gray.

  3. If the response is perfect (during the time window), then the background assert turns cyan.

The user only passes the quick-time test if they achieve outcome 3. The other two outcomes are considered failures.

The three colours represent an input which is too slow, perfect, or too fast, respectively


Testing

Setting up

The quick-time events features can be tested using the provided QuickTimeEventScreen which just provides a minimalistic screen containing two buttons, a display and the quick-time event render region.

Although this screen is not directly accessible from the main-menu screen, it can be tested by swapping out the screen in GdxGame to ScreenType.QUICK_TIME_EVENT:

@Override
public void create() {
    logger.info("Creating game");
    loadSettings();
    ...

    setScreen(ScreenType.QUICK_TIME_EVENT);
}

On launching the game, you are then greeted with the following screen:

Interacting with the Demo

The exit button will re-direct you back to the main-menu screen. The start button will begin a count down starting from 3.

Once the count reaches 0 (not displayed), a series of quick-time events will begin. Currently, the screen is rigged to execute four quick-time actions in a row. Each quick-time event will be progressively faster (shorter). This can be modified using the static quickTimeEventDemo() method in the QuickTimeEventActions component class.

A score will be shown at the bottom of the screen during the quick-time event sequence, initially reading "0/4". Each time that you successfully pass a quick-time event the score will increase. If you manage to pass all of the quick-time events and get a perfect score of "4/4", a special chime will play indicating this to the player.

Each time the start button is pressed, everything is flushed and the counter starts again.

An example interaction with the demo is shown below.

Modify Time Frame for Passing Event

If you wish to make the input time frame for passing the quick-time event longer or shorter, you can modify the QUICK_TIME_WINDOW static variable in the QuickTimeEventDisplay class. By default it is set to 40 ms.

UML Diagram