Added texture cache and sprite origins.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user