Posts | ||
---|---|---|
XNA: probs with sound, making menus, etc... :( | Locked | |
Thread Options | ||
Aug 13 2012 Anchor | ||
Hi everyone . Basically i have been following a tutorial on making a 2D XNA game. I have finished the tutorial and i am trying to add some features to the game myself. One of the features i am trying to add or even control is the game volume. There are multiple sound effects already included in my game, such as the launching of the rocket from the cannon, rocket colliding with the terrain and also colliding with another player. I have looked this up already and all i have found are solution that seem very ... well lets say more complex then they need to be it seems... (some solutions i found were on the MSDN website, which in my opinion arn't always the best or provide the easiest solutions...) What i want to do then is to be able to mute and unmute the game sound. Here is some code to try to explain and show what i have done or what is available atm:
The code for the other 2 variables have also been written, so i havent not written them (so i have written them ) but i havent included them in the code above, as they are both basically the same as the code for playing the launch sound, so hitCannon.Play();, etc. I will try to keep this as brief as possible, (without making a new thread ) but i am also (and i have always wanted to know how to do this in XNA) trying to create some form of menu. I think creating a main menu would be the best place to start lol, however i would also like to know how to create a pause menu and any other type of menu that may be relevant. I would appreciate any info on creating menus, so pointing me in the right direction, in terms of how to go about making menus would be great, i mean obviously i dont expect anyone to just give me code and for me to copy and paste it, as that wouldnt be too helpful for me gaining knowledge and im sure you wouldnt want me using your code .... So yea, thats it from me, hopefully this isn't as demanding or anything as other posts/essays i have created LOL. Thanks again everyone for the help and your time. |
||
Aug 13 2012 Anchor | ||
if you want to make like menus, like main menu to start game, credits screen, options screen, etc. I used this guys class. you can download it there. you can also use an enum to change the gamescreen, public enum gameScreen in the update thread you would have an if statement for it then can change what the currentscreen value is to change the screen page Here is some of my implementation for putting buttons, and detecting it via the mouse, then the button color changes when the mouse hovers over it
Edited by: atsebak |
||
Aug 14 2012 Anchor | ||
I actually wrote an entire form/GUI system myself from scratch. It works much better, since when you make it yourself it's much more flexible and "custom" to your game than just using someone else's libraries. I work with an 'interface' principle;
This interface is then implemented by classes, one class for every form/screen (main menu, options, game, etc) and a currently active form is then drawn through the main game class:
(Obviously, I'm leaving out all the code that's not relevant) The form can then be changed by setting the game class's ActiveForm property to something else. -- The Enrichment Center is required to remind you that MSBuild cannot speak. In the event that MSBuild does speak, the Enrichment Center urges you to disregard its advice. |
||
Aug 14 2012 Anchor | ||
Thanks for the post atsebak and NtWuff! I will try to translate the VB code to C# code . VB was actually my first language i was learning and i did try using VB with XNA, however i found that there wasnt that much support for it, although im sure there will be more support for it in the future, its just a matter of time . atsebak, i didnt really understand the globalvariables thing (soz ). I mean, of what type is globalvarialbes? Would i have to create some objects? Thanks --
|
||
Aug 14 2012 Anchor | ||
globalvariables was the name of one of my classes it was basically all global variables in it to make a global variable u just write public static datatype Edited by: atsebak |
||
Aug 15 2012 Anchor | ||
There still isn't much support for VB on XNA, but it works properly when you install the Windows Phone SDK as well, which adds the XNA project templates to the VB.NET categories. When you get that form system working, you can start actually writing GUI components. So far I've got a text box, combobox, buttons, list boxes... -- The Enrichment Center is required to remind you that MSBuild cannot speak. In the event that MSBuild does speak, the Enrichment Center urges you to disregard its advice. |
Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.