I'm making a 2D game using Monogame. My character loads to the game fine, however when a user presses the T key, I want my character to reload again (As if the character has teleported.)
I have loaded the player content in the LoadContent()
function like so:
player.Load(Content);
And in the Draw()
function, I have tried to reload the character again when 'T' is pressed by doing:
if (Keyboard.GetState().IsKeyDown(Keys.T))
{
player.Draw(spriteBatch);
}
and/or,
if (Keyboard.GetState().IsKeyDown(Keys.T))
{
player.Load(Content);
}
but neither of these seem to work.
My question is, what is the correct way to successfully load the character again and where do I place this if statement?
UPDATE:
Here's my player.Load()
method used in the player class:
public void Load (ContentManager Content)
{
texture = Content.Load<Texture2D>("danPlayer");
}