diff --git a/SampleGame/src/Player.bf b/SampleGame/src/Player.bf index 99342ad..63ea746 100644 --- a/SampleGame/src/Player.bf +++ b/SampleGame/src/Player.bf @@ -12,7 +12,7 @@ namespace Strawberry.Sample public this(Point pos) : base(pos) { - Hitbox = Rect(-4, -8, 8, 8); + Hitbox = Rect(-4, -8, 16, 16); Add(tJumpGrace = new Timer()); Add(tVarJump = new Timer()); @@ -102,8 +102,8 @@ namespace Strawberry.Sample { base.Draw(); - DrawHitbox(.Green); - //Game.Batcher.Tex(Assets.Textures["test"], X - 4, Y - 8); + DrawHitboxOutline(.Green); + Game.Batcher.Tex(Assets.Textures["test"], X - 4, Y - 8); } } } diff --git a/src/Core/Entity.bf b/src/Core/Entity.bf index 8182e46..7a3173a 100644 --- a/src/Core/Entity.bf +++ b/src/Core/Entity.bf @@ -238,6 +238,20 @@ namespace Strawberry } } + public Rect SceneHitboxOutline + { + [Inline] + get + { + Rect hb = Hitbox + Position; + hb.X -= 1; + hb.Y -= 1; + hb.Width += 2; + hb.Height += 2; + return hb; + } + } + public int Left { [Inline] @@ -463,6 +477,11 @@ namespace Strawberry Game.Batcher.Rect(SceneHitbox, color); } + public void DrawHitboxOutline(Color color) + { + Game.Batcher.Rect(SceneHitboxOutline, color); + } + public T SceneAs() where T : Scene { Runtime.Assert(Scene is T, "Scene type mismatch!");