Skip to main content

GameCommand

aac-voice-api


Defined in: commandLibrary.ts:15

Represents a voice-activated command that can trigger game actions.

GameCommand

Example​

const jumpCommand: GameCommand = {
name: "jump",
action: () => player.jump(),
description: "Makes the player character jump",
active: true
};

Properties​

action()​

action: () => void;

Defined in: commandLibrary.ts:32

The callback function to execute when this command is triggered. This function contains the game logic that should run when the voice command is recognized.

Returns​

void

Example​

() => player.jump()

active​

active: boolean;

Defined in: commandLibrary.ts:50

Whether this command is currently enabled and can be triggered. Inactive commands will not respond to voice input.

Default​

true

description​

description: string;

Defined in: commandLibrary.ts:41

A human-readable description of what this command does. Used for documentation, help menus, or accessibility features.

Example​

"Makes the player character jump into the air"

name​

name: string;

Defined in: commandLibrary.ts:23

The name/trigger phrase for the command. This is the word or phrase that will be recognized to trigger the action.

Example​

"jump", "move left", "fire weapon"