Skip to content

AudioCueSound

Carenalga edited this page Feb 6, 2023 · 2 revisions

Description

Inherits AudioCue.

An AudioCue intended to play sound effects, voices or graphic interface sounds.

Methods

Public

  • play( bool wait_to_end = false, Vector2 position_2d = Vector2.ZERO ) void

    🍑 Use this to play this audio cue inside an E.run() (a.k.a. queue of instructions) 🍑

    Plays the sound when running inside an E.run(). If wait_to_end is true the function will pause until the audio clip finishes. You can play the clip from a specific position_2d in the scene if the AudioCue has its is_2d property as true. Can be yield.

    # The player character (PC) will say "What is this?" once the audio clip finishes playing.
    yield(E.run([
      'Player: Lets see what we can find here.',
      A.sfx_locker_open.play(true),
      'Player: What is this?'
    ]), 'completed')
  • play_now( bool wait_to_end = false, Vector2 position_2d = Vector2.ZERO ) void

    Plays the sound immediately. If wait_to_end is true the function will pause until the audio clip finishes. You can play the clip from a specific position_2d in the scene if the AudioCue has its is_2d property as true. Can be yield.

    func on_room_entered() -> void:
      A.sfx_door_close.play_now()
Clone this wiki locally