Skip to content

Commit

Permalink
fixed collision detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Perdue committed Mar 13, 2022
1 parent 6856666 commit 4d3813e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Characters/Enemy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ public float[] playerDirection()

private void attack()
{
if (playerInView(40,true) && player.pushStats.isPushed() == false && player.attacking == false && !attacking)
if (playerInView(37,true) && player.pushStats.isPushed() == false && player.attacking == false && !attacking)
{
//attacking = true;
if (weapon != null)
Expand Down
2 changes: 1 addition & 1 deletion Characters/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public Player()
attackCooldown.Loop = true;
speed = 110;
health = 100;
damage = 5;
damage = 8;
healthBar = new ProgressBar(new Vector2(200, 32));
healthBar.ForegroundColour = Color.Green;
healthBar.BackgroundColour = Color.Red;
Expand Down
4 changes: 2 additions & 2 deletions Entities/Weapon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public bool checkAttack(Vector2 newPos,bool player)
currentEnemy.onDamage(damage*character.damage, character.attackDirection, (int)(knockback * 1.5));
hit = true;
}
else if (Math.Abs(enemyPos.X - currentPos.X) < 35 && Math.Abs(enemyPos.Y - currentPos.Y) < 35)
else if (Math.Abs(enemyPos.X - currentPos.X) < 40 && Math.Abs(enemyPos.Y - currentPos.Y) < 40)
{
currentEnemy.onDamage(damage, character.attackDirection, (int)(knockback * 1.5));
hit = true;
Expand Down Expand Up @@ -181,7 +181,7 @@ public virtual bool Attack(bool lungeAttack,bool player)
Point enemyTile = Scene.GridToTileLocation(enemy.Position);
if (lungeAttack)
{
if (Math.Abs(enemy.Position.X - character.Position.X) < 35 && Math.Abs(enemy.Position.Y - character.Position.Y) < 35)
if (Math.Abs(enemy.Position.X - character.Position.X) < 40 && Math.Abs(enemy.Position.Y - character.Position.Y) < 40)
{
enemy.onDamage(damage * character.damage, character.attackDirection, (int)(knockback * 1.5));
isAttacking = false;
Expand Down

0 comments on commit 4d3813e

Please sign in to comment.