Sound Actuator Loop Bidirectional: mode

mode
  • gets/sets the operation type of the sound actuator.

Type: 
  • integer

Values:

  • 1 = Play Stop
     
  • 2 = Play End
     
  • 3 = Loop Stop
     
  • 4 = Loop End
     
  • 5 = Loop Bidirectional
     
  • 6 = Loop Bidirectional Stop
Loop Bidirectional:
  • Plays the sound file from start to finish.  Then finish to start.  Over and over.
  • Positive Pulse:  Starts playing the sound file from the beginning.
  • Negative pulse:  Keeps playing the sound file until it reaches the end, then stops playing.
Sample Code


################  get the type of Sound Actuator

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the actuator attached to the controller
# my actuator is named Song

act = cont.actuators["Song"]

# get the type of Sound Actuator
type = act.mode
 
Sample Code


################  set the type of Sound Actuator

# import bge module
import bge

# get the controller
cont = bge.logic.getCurrentController()

# get the actuator attached to the controller
# my actuator is named Song

act = cont.actuators["Song"]

# set the type of Sound Actuator to Play Stop
act.mode = 1