using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; namespace AlienAttack.MonoGame.Things; public class Sprite(float x, float y) { public float XPosition { get; protected set; } = x; public float YPosition { get; protected set; } = y; public Vector2 Position => new(XPosition, YPosition); public Rectangle BoundBox { get; protected set; } protected Rectangle CollisionBox; protected Color DrawColor = Color.White; public bool CanCollide { get; protected set; } = true; public bool IsDead { get; protected set; } public virtual void Update(SpriteUpdateContext context) { CollisionBox = new Rectangle((int)XPosition + BoundBox.X, (int)YPosition + BoundBox.Y, BoundBox.Width, BoundBox.Height); } public bool Intersects(Sprite sprite) { return CollisionBox.Intersects(sprite.CollisionBox); } public virtual void Draw(SpriteDrawArgs args) { //spriteBatch.Draw(Texture, Position, DrawColor); } public virtual void OnCollision(SpriteCollisionContext context) { } }