mirror of
https://github.com/MaddyThorson/StrawberryBF.git
synced 2024-11-25 16:18:56 +08:00
Add hitbox outline utility method
This commit is contained in:
parent
d6713c3a96
commit
decb8b855d
|
@ -12,7 +12,7 @@ namespace Strawberry.Sample
|
||||||
public this(Point pos)
|
public this(Point pos)
|
||||||
: base(pos)
|
: base(pos)
|
||||||
{
|
{
|
||||||
Hitbox = Rect(-4, -8, 8, 8);
|
Hitbox = Rect(-4, -8, 16, 16);
|
||||||
|
|
||||||
Add(tJumpGrace = new Timer());
|
Add(tJumpGrace = new Timer());
|
||||||
Add(tVarJump = new Timer());
|
Add(tVarJump = new Timer());
|
||||||
|
@ -102,8 +102,8 @@ namespace Strawberry.Sample
|
||||||
{
|
{
|
||||||
base.Draw();
|
base.Draw();
|
||||||
|
|
||||||
DrawHitbox(.Green);
|
DrawHitboxOutline(.Green);
|
||||||
//Game.Batcher.Tex(Assets.Textures["test"], X - 4, Y - 8);
|
Game.Batcher.Tex(Assets.Textures["test"], X - 4, Y - 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
public int Left
|
||||||
{
|
{
|
||||||
[Inline]
|
[Inline]
|
||||||
|
@ -463,6 +477,11 @@ namespace Strawberry
|
||||||
Game.Batcher.Rect(SceneHitbox, color);
|
Game.Batcher.Rect(SceneHitbox, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DrawHitboxOutline(Color color)
|
||||||
|
{
|
||||||
|
Game.Batcher.Rect(SceneHitboxOutline, color);
|
||||||
|
}
|
||||||
|
|
||||||
public T SceneAs<T>() where T : Scene
|
public T SceneAs<T>() where T : Scene
|
||||||
{
|
{
|
||||||
Runtime.Assert(Scene is T, "Scene type mismatch!");
|
Runtime.Assert(Scene is T, "Scene type mismatch!");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user