Game Development Community

Some questions on things i cant figure out for my game

by DeSilva · in Torque X 2D · 02/23/2009 (4:08 pm) · 2 replies

I have a few things that ive been trying to figure out for my game but cant seem to get to work, they are:

Background music- I have the torque x book but all it shows me is how to make a sound after hitting something and i couldnt really figure out how to adapt things.

Changing levels- I dont know how to change levels lol im sure its s stupid question and is easy but it doesnt seem to work the way ive been doing it. Basically once you beat the level i have a splash screen saying the level was completed then i want to switch to level 2 but i get errors..


#1
02/23/2009 (7:49 pm)
Here's a thread talking about changing levels:
www.garagegames.com/community/forums/viewthread/74103
Not too sure on music. Shouldn't be too much different than any other sound though.

Brian
#2
02/24/2009 (6:07 am)
For the sound, I'd make a component to manage the back ground sound. Then just create the torque object and register it during your game setup. Basically the component should just handle playing music in your game based on game states or whatever.

I don't know if this is the best way, but it's worked pretty well for me for things that you want to basically happen in the back ground such as random events or in your case background music.

Here is basically all you have to do in your Game.cs beginrun method:
TorqueObject obj = new TorqueObject();
            obj.Components.AddComponent(new BackGroundMusic());
            TorqueObjectDatabase.Instance.Register(obj);

Your background music class would not necessarily have to be a torque component, but if you do it this way you can have a process tick method that you can check stuff like game state changes