jasse_91

im kinda new to xna and c# and when i tried to debug now i get some errors that i dont know how to fix lol. heres the errors i get

this is what i wrote in:

protected override void Draw(Microsoft.Xna.Framework.GameTime gameTime)

{

this.graphics.GraphicsDevice.Clear(Microsoft.Xna.Framework.Graphics.Color.Black);

this.spritebatch.Begin(Microsoft.Xna.Framework.Graphics.SpriteBlendMode.AlphaBlend);

this.spritebatch.Draw(this.mytexture, this.spriteposition, Microsoft.Xna.Framework.Graphics.Color.White);

this.spritebatch.End();

base.Draw(gameTime);

}

and heres the errors:

error 1 = Error 1 The best overloaded method match for 'Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw(Microsoft.Xna.Framework.Graphics.Texture2D, Microsoft.Xna.Framework.Vector2, Microsoft.Xna.Framework.Rectangle , Microsoft.Xna.Framework.Graphics.Color)' has some invalid arguments C:\Documents and Settings\Edina Japalak\My Documents\Visual Studio 2005\Projects\first game\first game\Engine.cs 46 13 first game

Error 2 = Argument '1': cannot convert from 'first_game.engine' to 'Microsoft.Xna.Framework.Graphics.Texture2D' C:\Documents and Settings\Edina Japalak\My Documents\Visual Studio 2005\Projects\first game\first game\Engine.cs 46 35 first game

error 3 = Error 3 Argument '2': cannot convert from 'Microsoft.Xna.Framework.Graphics.Texture2D' to 'Microsoft.Xna.Framework.Vector2' C:\Documents and Settings\Edina Japalak\My Documents\Visual Studio 2005\Projects\first game\first game\Engine.cs 46 40 first game

error 4 = Error 4 Argument '3': cannot convert from 'Microsoft.Xna.Framework.Vector2' to 'Microsoft.Xna.Framework.Rectangle ' C:\Documents and Settings\Edina Japalak\My Documents\Visual Studio 2005\Projects\first game\first game\Engine.cs 46 51 first game

help if u know whats wrong plz.. ty



Re: XNA Game Studio Express need help..

irishcoder

hard to say from that code snippet, remember the error can often be outside the line that the compiler complains about but a few things to check.

are this.mytexture and this.spriteposition the correct object types in your class definition i.e.

Texture2D myTexture;
Vector2 spriteposition;

if they are declared correctly check to ensure that they are initialised properly I could be wrong but they are both class's and need to be created You use the contentmanager to load a texture or if windows only use the Texture2D.LoadFromFile to create a texture.

Welcome to the wonderfull world of debugging ;-) im sure there will be others along shortly who can help more than I can!

btw. Unlike VB (if thats were your u usually develop) c# is case sensetive and very pernikty about it's ; and { } check those as well...







Re: XNA Game Studio Express need help..

jasse_91

i checked and cant see anything thats wrong but when i debugged i got more errors without changing anything at all heres another error lol:

A problem occurred while trying to set the "Sources" parameter for the IDE's in-process compiler. Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

still need help





Re: XNA Game Studio Express need help..

irishcoder

sorry to say this but it sounds that either your xna and/or c# express install is corrupted or there is a chance that your pc is starting to give up the ghost ie hard drive or ram is starting to fail!

I hope i'm wrong in this case but try to uninstall your dev tools and reinstall and see if that helps. Have u tried exiting the dev environment or rebooting

run a lowlevel diskcheck to c if youv'e any bad clusters on your harddrive.

Other than that I personally can't think of anything that could be the root cause of your problems as I said someone with greater insight might be along soon.






Re: XNA Game Studio Express need help..

Bill Reiss

The "corrupt" error I would get intermittently while debugging before I installed Service Pack 1 for C# Express. After that I haven't seen it.

As for your other errors, can you post the code for your declarations so that we can confirm that you're declaring them with the correct types






Re: XNA Game Studio Express need help..

irishcoder

phew so my doom and gloom was premature c I knew someone who knew more would happen along...




Re: XNA Game Studio Express need help..

jasse_91

declarations sry i just started and ill install service pack 1 then.. and i scanned comp now and restarted it but its still same errors



Re: XNA Game Studio Express need help..

Stephen Styrchak - MSFT

Bill Reiss wrote:

The "corrupt" error I would get intermittently while debugging before I installed Service Pack 1 for C# Express. After that I haven't seen it.

Yes, this is caused by a known bug in the Exception Assistant which affects XNA projects and was fixed in Service Pack 1 for C# Express.

The problem occurs whenever the Exception Assistant dialog is displayed while debugging an XNA Game project. The Exception Assistant is disabled for Xbox 360 game projects, but is enabled by default for Windows game projects. Now that SP1 is available, we recommend installing SP1. However, prior to SP1, we recommended disabling the Exception Assistant (using the Tools | Options | Debugging page) when debugging XNA projects.

We documented the bug, but it wasn't very prominent nor was it easy to find help for it. Sorry about that.

--Stephen





Re: XNA Game Studio Express need help..

Bill Reiss

jasse_91 wrote:
declarations sry i just started and ill install service pack 1 then.. and i scanned comp now and restarted it but its still same errors

Yes, if you could post from the top of your Game1 file the lines where you define mytexture and spriteposition, that would help the troubleshooting. It should looks something like:

Texture2D mytexture;
Vector2 spriteposition;

based on the code snippet you posted.






Re: XNA Game Studio Express need help..

jasse_91

ill reinstall it then and see if its any better :S



Re: XNA Game Studio Express need help..

irishcoder

Jasse from what the lads are saying an uninstall might not be needed. what you need to do is goto windows update and it will pick up that your machine needs service pack 1 for your c# express dev environment (a service pack fixs bugs,improves code etc) have u much programming experience or have you decided to jump in at the "deep" end while .net and xna make things simpler u still need a decent grounding in programming principals b4 it will make sense.

Sorry should have been microsoft update not windows.





Re: XNA Game Studio Express need help..

jasse_91

ok ill try that and im new to this just dled this few days ago and havent programmed before lol



Re: XNA Game Studio Express need help..

irishcoder

Sound. Your best bet is to start simple and get used to programming c# b4 u try xna. There are loads of sites out there with the info you'll need to take your first few steps. (Start simple and work your way up, there are also loads of books available on the subject. Like any activity it's better to learn to walk before you try to run!!) Welcome to programming, but beware its addictive!!!!!! and annoying .... and heartbreaking , but worth it to look at something and know you created it. Best of luck.




Re: XNA Game Studio Express need help..

Bill Reiss

You may want to check out my series of tutorials on getting started with XNA, the first entry is here:

http://xna101.spaces.live.com/blog/cns!77EE4BD533D8ECAE!120.entry

and then it steps through creating a 2D XNA game program and tries to explain the basic C# concepts along the way.

Or if you prefer video tutorials you can check out http://www.xnatutorial.com/ where Joran also targets beginning developers.

Bill






Re: XNA Game Studio Express need help..

jasse_91

lol ty ive been watchin a few tutorials and will order a book as soon as my mom lets me lol she scared of buyin stuff over internet :S