Hello, I bought a book on 2D game development and the book wants me to create 3 static classes but I keep getting an error.
Here is the code that applies to what I’m doing
public class Game1 : Game
static public SpriteBatch sSpriteBatch; //Drawing support
static public ContentManager sContent;//Loading textures
static public GraphicsDeviceManager sGraphics; // Current Display size
The error I recieve is “The type or namespace name ‘ContentManager’ could not be found (are you missing a using directive or an assembly reference?)”
Is this outdated? should I be using something else in place of static public ContentManager sContent?
you’re probably missing
You were correct,
Thank you very much. Made me fell a little silly
If you are using an XNA book you are very likely to come across alot of issues, MonoGame is very very close to XNA but still has its slight differences and alot of namespaces exist in MonoGame for i guess organization purposes that XNA didnt have so you will be missing references alot… If you get Trial ReSharper (I think Maybe a Visual Studio 2015 IDE will also have this feature built in) it will highlight the line with red that is errored and suggest adding missing references… which will usually ALWAYS have the correct references you need
Thanks for the advice.
The book is called Learn 2D Game Deelopment with C#. I’'m between classes right now and wanted to try something new so I grabbed this book.
I’m using Visual Studio 2015 already and you are correct VS 2015 does underline any issues in red.
If you are really interested, I recommend you take to youtube and using specificly MonoGame based tutorials… They will get you quickly into actual game development without you having to figure out why certain things from the Xna book arent working… If it has anything about networking or the Live interface or just some of the background features not alot of people used anyway MonoGame wont perfectly be compatible…
That is a decent tutorial series, it doesnt have the example projects available anymore, but its still really useful and works copying straight from video… as well the XML stuff that he makes you use everywhere is very friendly to newbies to modify data without easily breaking functionality.