Skip to content

Commit

Permalink
Merge pull request #94 from thegreatzoidberg/AttackModifier
Browse files Browse the repository at this point in the history
Attack modifier
  • Loading branch information
thegreatzoidberg authored Apr 16, 2024
2 parents 07a401d + 32d5f78 commit 8bb4fe6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Game/LifeQuest/enemy.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func on_hit():
print("Enemy is being hit.")
attackCooldown = true
$enemyCooldown.start()
enemyHealthStat = enemyHealthStat - playerAttack
enemyHealthStat = enemyHealthStat - (playerAttack + randi_range(-(playerAttack / 10), (playerAttack / 10))) # Attack range is playerAttack +/- 10% or +/-1 if too small
print("Enemy health is: " + str(enemyHealthStat))

if enemyHealthStat <= 0:
Expand Down
2 changes: 1 addition & 1 deletion Game/LifeQuest/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func on_hit():
print("Player is being hit.")
attackCooldown = true # cooldown timer is active, cannot take another hit until timer is up
$cooldown.start() # Player cannot be hit for another 3 seconds
playerHealthStat = playerHealthStat - enemyAttack
playerHealthStat = playerHealthStat - (enemyAttack + randi_range(-(enemyAttack / 10), (enemyAttack / 10))) # Attack range is enemyAttack +/- 10% or +/-1 if too small
print("Player health is: " + str(playerHealthStat))

if playerHealthStat <= 0: # If player health is less than or equal to 0, player is no longer alive
Expand Down

0 comments on commit 8bb4fe6

Please sign in to comment.