using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
namespace Article_sprite
{
class Sprite
{
Vector2 position;
Texture2D texture;
// Le constructeur
public Sprite(Vector2 position)
{
this.position = position;
}
//Permet de récuperer la position de l'objet
public Vector2 Position
{
get { return position; }
set { position = value; }
}
//Charge l'image selon son nom depuis le Content Manager
public void LoadContent(ContentManager content, string assetName)
{
texture = content.Load<Texture2D>(assetName);
}
//Donne un mouvement de translation au sprite
public void Update(Vector2 translation)
{
position += translation;
}
//Affiche le sprite
public void Draw(SpriteBatch spriteBatch)
{
spriteBatch.Draw(texture, position, Color.White);
}
}
}