Added texture cache and sprite origins.

This commit is contained in:
2026-01-14 23:09:13 -05:00
parent fcb4f1cf05
commit 61d51f5188
36 changed files with 319 additions and 83 deletions

View File

@@ -22,6 +22,8 @@ public abstract class Item : MoveableSprite
public Item(int x, int y) : base(x, y)
{
YVelocity = .5f;
Origin = new(Width / 2, Height / 2);
BoundBox = new Rectangle(0, 0, Width, Height);
_anchor = new Vector2(x, y);
@@ -34,7 +36,7 @@ public abstract class Item : MoveableSprite
Texture2D texture = args.Content.Load<Texture2D>(TextureName);
args.SpriteBatch.Draw(texture, Position, null, DrawColor, 0, new Vector2(0, 0), _scale, SpriteEffects.None, 1);
args.SpriteBatch.Draw(texture, Position, null, DrawColor, 0, Origin, _scale, SpriteEffects.None, 1);
}
public override void Update(SpriteUpdateContext context)