I decided to try taking up monogame a few days ago and followed this tutorial coupled with visual studio 2013: http://blogs.msdn.com/b/tarawalker/archive/2012/12/04/windows-8-game-development-using-c-xna-and-monogame-3-0-building-a-shooter-game-walkthrough-part-1-overview-installation-monogame-3-0-project-creation.aspx
After a lot of messing about I managed to complete the 6 available lessons (the rest are (hopefully) still being written) but decided to give up venturing further in messing with the code as monogame seemed to have some very bad problems which after much research I found was supposed to be fixed in the latest developer branch, but still didn't work.
I then decided to install VS2010 and XNA and redo the tutorial using XNA instead. After much messing about having to manually convert texture files to XNB (no idea why they wasn't converting automatically) I have again completed the 6 lessons of the tutorial with one problem!
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ProjectSummer;
namespace Shooter
{
class Player
{
public Animation PlayerAnimation;
public Vector2 Position; // Player Position Relative to the Upper Left of the Screen
public bool Active; // State of the player
public int Health; // Player HP
public int Width // Width of Player Ship
{get { return PlayerAnimation.FrameWidth; }}
public int Height // Height of Player Ship
{get { return PlayerAnimation.FrameHeight; }}
public void Initialize(Animation animation, Vector2 position)
{
PlayerAnimation = animation;
Position = position;
Active = true;
Health = 100;}
public void Update(GameTime gameTime)
{
PlayerAnimation.Position = Position;
PlayerAnimation.Update(gameTime);
}
public void Draw(SpriteBatch spriteBatch)
{
PlayerAnimation.Draw(spriteBatch);
}
}
}
The problem seems to come from "PlayerAnimation.Position = Position;" code. it keeps returning
NullReferenceException was unhandled Object reference not set to an instance of an object.
I'm not sure why this problem is happening in XNA but not in Monogame. I've checked all of my code files and aside from obvious formatting differences they're the same.
Help on this would be greatly appreciated