Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Software Development
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory monitor motherboard network operating system printer problem ram registry router slow software sound svchost.exe toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
C# Coding help, please

Reply  
Thread Tools
DYS's Avatar
DYS DYS is offline
Member with 462 posts.
 
Join Date: Dec 2008
Experience: Beginner
06-Feb-2010, 03:41 PM #1
C# Coding help, please
Hi.

I've recently started working C# coding to develop a 2D game.

I'm trying to work out the basics at the moment, but one thing I'm eager to work out is how to add audio to the project.
I've had a look around the internet but I haven't been able to find a significant solution, or unless I've just been doing it all wrong.

I'm using Microsoft Visual C# 2008 Express Edition, and am working on a Windows XNA game.

I'd also like to be able to know when I can set a start point for an audio file, as well as just having one play from the start.

Thanks in advance
peterh40's Avatar
Computer Specs
Senior Member with 1,082 posts.
 
Join Date: Apr 2007
Location: England
Experience: Advanced
06-Feb-2010, 07:11 PM #2
There are good docs on msdn. Try here for starters:
http://msdn.microsoft.com/en-us/library/bb195053.aspx
DYS's Avatar
DYS DYS is offline
Member with 462 posts.
 
Join Date: Dec 2008
Experience: Beginner
06-Feb-2010, 07:51 PM #3
Quote:
Originally Posted by peterh40 View Post
There are good docs on msdn. Try here for starters:
http://msdn.microsoft.com/en-us/library/bb195053.aspx
Ah thanks man. It's done the job. However, I'm still unsure on when to trigger music to play at cetain stages.

For example, if the user gets to a GAME OVER stage, any idea how I would go about playing a particular sound then?

Cheers though.
peterh40's Avatar
Computer Specs
Senior Member with 1,082 posts.
 
Join Date: Apr 2007
Location: England
Experience: Advanced
07-Feb-2010, 08:33 AM #4
I haven't written any game code for ages but you would normally test for one or more end conditions e.g. No lives left and then display some game over graphics and then play the sound, after that loop for n seconds to allow the sound to complete and then return to menu.
__________________
Peter Hutchison, UK
DYS's Avatar
DYS DYS is offline
Member with 462 posts.
 
Join Date: Dec 2008
Experience: Beginner
07-Feb-2010, 04:07 PM #5
Right, okay, that's some indication.

Thanks for your help, mate
DYS's Avatar
DYS DYS is offline
Member with 462 posts.
 
Join Date: Dec 2008
Experience: Beginner
07-Feb-2010, 04:46 PM #6
Stumbled across another problem now.

I'm trying to add Gamestates. My problem occurs when I want to allow a key input which will change the Gamestate.

My initial Gamestate is set to 'START', and I want to make it go into 'PLAYING'. I have this in my Update method:
Code:
KeyboardState keyState = Keyboard.GetState();

            if (KeyState.IsKeyDown(Keys.S))
                gameState = Gamestate.PLAYING;
However, when I try to build the solution it tells me that there is no definition for 'IsKeyDown'.
I've looked at an example piece of code for another game which has the same code that I am having the problem with and I cannot find a definition for 'IsKeyDown' anywhere in the code.

Thanks.
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:20 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.