Skip to content

Commit

Permalink
Merge pull request #140 from Permafrost-Game/combat-system-2.0
Browse files Browse the repository at this point in the history
Combat system 2.0
  • Loading branch information
mrKrastev authored Mar 15, 2020
2 parents 0afc341 + d053547 commit 115f7df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public bool InCombat
if (value == false)
{
TextureGroupIndex = 0;
IsAttacking = false;
}

}
Expand Down Expand Up @@ -212,10 +213,11 @@ public override void Update(GameTime gameTime)

if (delta.Equals(Vector2.Zero))
{
if (!IsAttacking)
if (!IsAttacking && instructions.Count==0)
{
//TextureGroupIndex = 0;
//isAnimated = false;
TextureGroupIndex = 0;


}
}
else if (Math.Abs(delta.X) >= Math.Abs(delta.Y))
Expand Down Expand Up @@ -244,8 +246,12 @@ public override void Update(GameTime gameTime)
}
else
{
combatModeOn = false;

if (combatModeOn)
{
IsAttacking = false;
combatModeOn = false;
}

}
if (combatModeOn)
{
Expand Down Expand Up @@ -437,6 +443,7 @@ private void ColonistAttack(GameTime gameTime)
this.InCombat = false;
this.IsAttacking = false;


}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,9 @@ public void SetEnemyDead(){
TextureGroupIndex = 1;
Speed = 0.05f;//decreasing the default speed when roaming (more natural)
Goals.Enqueue(this.Position + ai.RandomTranslation()); //make it go randomly around

}
else
{

Speed = 0.2f;//return to normal speed (seems like speeding up when moving from roaming to chasing)
ChaseColonist(target); //chase the found colonist
}
Expand Down Expand Up @@ -205,8 +203,9 @@ public override void Update(GameTime gameTime){
{
PerformCombat(gameTime,targetInRange); // fight if theres anyone to fight
}
else if(target!=null)
else if(target!=null && targetInRange==null)
{
SetInCombat(false);
TextureGroupIndex = 1;
Goals.Clear();
ChaseColonist(target); //if there isnt anyone in attacking range then check if anyone is around and chase him
Expand Down

0 comments on commit 115f7df

Please sign in to comment.