Thursday 7 March 2013

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 MySecondProject
{
    class Sprites
    {
        //member variables
        public Texture2D texture;
        public Vector2 position;
        public Vector2 velocity;

        //Constructors
         public Sprites(Vector2 pos, Vector2 vel)
         {
             position = pos;
             velocity = vel;

         }
         public Sprites()
         {
             position = Vector2.Zero;
             velocity = Vector2.Zero;

         }

        //Functions
        //When users specify assetName the value will get passed into the assetName
        public void Load(ContentManager Content, string assetName)
         {
             texture = Content.Load
                        (assetName);
         }

        public void Update()
        {
            position += velocity;
        }
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(texture, position, Color.White);
        }
    }
}

No comments:

Post a Comment