I have tried to load texture on the PlayerTank
class constructor. But I have received NullReferenceException
.
namespace BattleCityv1._5.Tanks
{
class PlayerTank : Tank
{
public PlayerTank(int life, Point position)
{
texture = Content.Load<Texture2D>(@"images/PlayerTankSpriteSheet");
Life = life;
Rectangle = new Rectangle(position.X, position.Y, 32, 32);
Source = new Rectangle(0, 0, Rectangle.Width, Rectangle.Height);
type = "player1";
Color = Color.White;
}
}
}