diff --git a/core/assets/sprites/swinghitbox.png b/core/assets/sprites/swinghitbox.png new file mode 100644 index 0000000..59e08fd Binary files /dev/null and b/core/assets/sprites/swinghitbox.png differ diff --git a/core/src/com/saltosion/gladiator/components/CCombat.java b/core/src/com/saltosion/gladiator/components/CCombat.java index 3288a60..0274eac 100644 --- a/core/src/com/saltosion/gladiator/components/CCombat.java +++ b/core/src/com/saltosion/gladiator/components/CCombat.java @@ -11,7 +11,7 @@ public class CCombat extends Component { public int health = 0; private int maxHealth = 0; private int damage = 0; - private Vector2 swingsize = new Vector2(4, 4); + private Vector2 swingsize = new Vector2(4, 3); private Vector2 swinging = new Vector2(); private float swingCd = 0; diff --git a/core/src/com/saltosion/gladiator/systems/CombatSystem.java b/core/src/com/saltosion/gladiator/systems/CombatSystem.java index 6dcfef2..f9052a6 100644 --- a/core/src/com/saltosion/gladiator/systems/CombatSystem.java +++ b/core/src/com/saltosion/gladiator/systems/CombatSystem.java @@ -57,13 +57,13 @@ public class CombatSystem extends EntitySystem { Vector2 pos = obj.getPosition().cpy(); if (combat.getSwingDirection() == Direction.LEFT) { - pos.add(-2, 0); + pos.add(-combat.getSwingSize().x/2, 0); } else if (combat.getSwingDirection() == Direction.RIGHT) { - pos.add(2, 0); + pos.add(combat.getSwingSize().x/2, 0); } else if (combat.getSwingDirection() == Direction.UP) { - pos.add(0, 2); + pos.add(0, combat.getSwingSize().y); } else if (combat.getSwingDirection() == Direction.DOWN) { - pos.add(0, -2); + pos.add(0, -combat.getSwingSize().y/3*2); } createSwingHitbox(e, pos); @@ -75,7 +75,7 @@ public class CombatSystem extends EntitySystem { public void createSwingHitbox(Entity source, Vector2 position) { Entity e = new Entity(); CCombat combat = cm.get(source); - Sprite s = SpriteLoader.loadSprite(Name.WALLIMG); + Sprite s = SpriteLoader.loadSprite(Name.SWINGHITBOXIMG); e.add(new CRenderedObject(s)); e.add(new CPhysics().setGhost(true).setGravityApplied(false).setMovable(false) .setSize(combat.getSwingSize())); diff --git a/core/src/com/saltosion/gladiator/util/Name.java b/core/src/com/saltosion/gladiator/util/Name.java index 5921a05..4643e4c 100644 --- a/core/src/com/saltosion/gladiator/util/Name.java +++ b/core/src/com/saltosion/gladiator/util/Name.java @@ -8,6 +8,7 @@ public class Name { public static final String PLAYERIMG = "PLAYERIMG"; public static final String GROUNDIMG = "GROUNDIMG"; public static final String WALLIMG = "WALLIMG"; + public static final String SWINGHITBOXIMG = "SWINGHITBOXIMG"; public static final String MOVE_LEFT = "MOVE_LEFT"; public static final String MOVE_RIGHT = "MOVE_RIGHT"; diff --git a/core/src/com/saltosion/gladiator/util/SpriteLoader.java b/core/src/com/saltosion/gladiator/util/SpriteLoader.java index c0f89c3..a4efa07 100644 --- a/core/src/com/saltosion/gladiator/util/SpriteLoader.java +++ b/core/src/com/saltosion/gladiator/util/SpriteLoader.java @@ -16,6 +16,7 @@ public class SpriteLoader { loadTexture(Name.PLAYERIMG, "sprites/player/player.png"); loadTexture(Name.GROUNDIMG, "sprites/ground.png"); loadTexture(Name.WALLIMG, "sprites/wall.png"); + loadTexture(Name.SWINGHITBOXIMG, "sprites/swinghitbox.png"); } /**