Fangames > Programming Questions
Non-Restarting music only working on one song?
xElectricZz:
the engine I'm using is Yutuuu Edition.
While trying to make my fangame music not restart, i looked around this forum and found some code Seph posted under an older thread, along with instructions to delete a few things in a few objects..
--- Code: ---if !sound_isplaying(song) { sound_loop(song); }
--- End code ---
When i deleted the things, and used this under the creation code of the playMusic object for the default track01, (guy rock), it worked. I pressed R, the music didn't restart. I died, it didn't restart. i switched rooms, it didn't restart.
But, after that testing, i added in some music i found so i didn't have to use guy rock on some rooms. Once i added it, and tried it on a a few rooms, it didn't work. The strange thing is, the rooms with guy rock worked perfectly. The room restarted quickly, and the music didn't ever restart. In the rooms with my music, the room took about a full second to load every time i hit R, and the music restarted. while it was loading, it looked like it was trying to resize itself a bit. before posting this i messed around in game maker for about 60 or so minutes on and off trying to fix it. does anybody have any idea what I'm doing wrong?
infern0man1:
Well, how big is the music file? Sometimes it can lag the game a bit because music takes up a large amount of memory.
YoSniper:
Is "song" a variable that could represent a variety of sound files in your library? It would help to make sure you are setting the variable "song" correctly before trying to play the sound.
Then again, you may have already considered this. But without seeing the whole code, I can't be sure.
xElectricZz:
The song i'm using is a 6.17MB mp3 file.
The code i'm using is this. I ctrl + right click the playMusic object in a room, and click Creation Code. There, i paste the code i put into the OP. I believe it is a variable of any sounds in the music folder. The name of both show in yellow so i know i got the names correct of what i named them in game maker. If it matters, under the music folder put there for me in yuuutu edition, i made a new folder under that folder entitled "Area 1" to organize my music, and put it in there.
This is the song that won't work for me, and restarts every time.
--- Code: ---if !sound_isplaying(buttdawgfunk) { sound_loop(buttdawgfunk); }
--- End code ---
This is the song that came with Yuuutu edition, guy rock.
--- Code: ---if !sound_isplaying(track01) { sound_loop(track01); }
--- End code ---
If it helps, this is where i got the song. https://chiptuneswin.com/track/buttdawg-funk
infern0man1:
--- Quote from: xElectricZz on February 08, 2014, 06:36:28 PM ---The song i'm using is a 6.17MB mp3 file.
--- End quote ---
:PogChamp: You need to compress that sound file. That's probably the main reason why the game is doing that.
Navigation
[0] Message Index
[#] Next page
Go to full version