Playing sound FX and music in Stencyl

Well done! You have now successfully imported both music and sound FX files. Now all that remains is to trigger them in the code. Perform the following steps to do so:

  1. Open up the Player Handler behavior, and in the events pane, switch to Created, as shown in the following screenshot:
    Playing sound FX and music in Stencyl
  2. In the blocks palette, go to Sound & Images | Sound | Playback, then drag out a Play Sound block, and add it to the stock of blocks in the when created event block, as shown in the following screenshot:
    Playing sound FX and music in Stencyl
  3. Change Play to Loop, as shown ...

Get Stencyl Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.