jetlag2d
    Preparing search index...

    Class SoundEffectComponent

    SoundEffect provides a set of sounds associated with events that can happen to an actor. This lets us easily know which sound to play without having to rely on a callback. Note that this component has the full set of possible sounds, even though not all are appropriate for any single actor.

    Index
    • Construct a SoundEffectComponent from the file names of the sounds to play on events.

      Parameters

      • config: Partial<Record<SoundEffectName, string>>

        An object with the names of the sounds for events for which a sound should play

        • disappear

          The sound to play when the actor disappears

        • toss

          The sound to play when the actor tosses a projectile

        • arrive

          The sound to play upon arrival at a destination

        • defeat

          The sound to play when the actor is defeated

        • jump

          The sound to play when the actor jumps

        • collide

          The sound to play when there is a collision with this actor

        • punch

          The sound to play when the actor punches

      Returns SoundEffectComponent

    • Play the sound effect for which event, but only if it isn't already playing -- useful for events (like repeated collisions) that can recur faster than the sound finishes

      Parameters

      Returns void