Author Topic: Reload Saved game and background music does not play  (Read 3633 times)

guildhallC4

  • Guest
Reload Saved game and background music does not play
« on: 2005-03-16, 05:07:15 PM »
I'm using a save special function at certain checkpoints in my game. When the player dies, the game switches you to a separate map, which asks if you want to continue or quit. If you continue, it reloads the last save. Everything works beautifully, except that when the game is reloaded, the background music no longer plays. Am I doing something wrong, or is this just the way it works? Any suggestions on ways around it?

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Background Music After Load
« Reply #1 on: 2005-03-16, 06:35:37 PM »
Background music is triggered when switching to a map.  Apparently the current design doesn't see loading a game as switching to a map but just picking up where you left off.  There are a couple ways around this:
  • Put functions at the save points that activate constantly and have the background music clip associated with them.  I'm not sure whether it would work better to set the function to "Play clip" or to "Change music" on that clip.  But the idea is, if the music is already playing it will simply continue to play (as long as you don't have "Allow interrupt/restart" checked), otherwise it will begin playing.  So when you come back after loading a saved game and happen to be touching the function, the music will start up as a result of touching the function.  I would say to associate the clip with your save function, but hopefully your save function is set to activate only on initial touch, and I don't know if it would be triggered after a load (because you were already touching the function when you saved).
  • Have your save functions switch to another map instead of saving (and check the box for "Remember Old Map").  This other map will be the central point for saving games (you could have a menu with multiple save slots there).  On this map you will have the save function activate a series of functions: first transport the player sprite to a special location on the map and second, save the game.  The special location on the map should switch to the old map with "<Return to old map>".  Part of returning to the old map should implicitly activate the music for that map.  For a sample of this method of saving games from a separate map (and multiple save slots) see the Game Academy Demo project in the project listing.


I recommend the second solution -- it's cleaner and more powerful I think.

Eastfist

  • Contributor
  • Regular
  • **
  • Posts: 54
    • View Profile
    • Eastfist - Chongchen Saelee
Reload Saved game and background music does not play
« Reply #2 on: 2005-03-17, 10:17:13 PM »
I encountered the same thing when I was developing my game, The Project. I just slapped a disposable special function with an assigned media clip at the beginning of each map. It worked for me.
"What's in a game?"  Juliet says to insult Romeo.