0 Favourites

Sounds/Music Folder

This forum is currently in read-only mode.
  • How would I go about externally loading sounds that are in a folder separate from the .cap or .exe? As in...

    Game>game.exe

    Game>SFX>(numerous folders full of sounds)>sounds

    I tried

    +Start of layout

    -(Xaudio2) cache directory AppPath

    +Something happens

    -(Xaudio2) Autoplay file AppPath&"Sound.wav"

    Well that only plays the sound if it's in the folder the .cap or .exe is in. So I appended &"SFX" (Folder name is SFX) to the action in the first event, but that didn't work. I tried a few other combinations of AppPath and folders, but nothing worked.

  • i remember a Resources Plugin i think did that too.

  • That's easy. Type

    AppPath & "SFX\sound.wav"[/code:19nhexrj] in the parameter and you're done. No need to download any plugin
  • Oh, cool. Thanks man!

  • Even though I've used sounds and music before, the AppPath thing still confuses me from time to time.

    IE, i forget what it means.

    Does AppPath mean something like:

    Game\Music & "Cool Jams.wav"?

  • Even though I've used sounds and music before, the AppPath thing still confuses me from time to time.

    IE, i forget what it means.

    Does AppPath mean something like:

    Game\Music & "Cool Jams.wav"?

    AppPath is a text variable that stores the path to your game folder (the folder where your .exe or .cap is stored)

    If you would have your game stored in a folder "mycoolgame" on C: then AppPath would have this content:

    "C:\mycoolgame\"

    EDIT: A look at "Verve!" might also help with this

  • Should I always use AppPath? Because when I use relative path like "folder\file.txt" it still works with or without it.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Think about when your game is on someone elses computer, in a different folder, on a different drive.

  • You should use it like:

    AppPath + "folder\file.txt[/code:e7as03pc]
    So this will get the folder where the game is, then go inside the "folder" folder, and find the file "file.txt". You can have as many folders as you want, and any kind of file you need
    
    Btw you can set the file to a variable, eg:
    [code:e7as03pc]AppPath + "save\" + global('player_name') + ".sav"[/code:e7as03pc]
  • I ran into bugs with this one on a project I finished during the summer time. Everything was fine with the .cap, but with the .exe things changed; some sounds and music played in the .exe but some didn't, even though the paths were right.

    I hope for 1.0 this will be like MMF and embed in the file.

  • I would recommend to not use "+" but "&" to concetenate paths. The wiki explicitly states "&" for concetenating strings, not "+", while "+" is only listed for math addition.

    While it may work in the cap it may refuse to work in the exe.

  • Should I always use AppPath? Because when I use relative path like "folder\file.txt" it still works with or without it.

    You should. I experienced some bugs, when not using AppPath...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)