Skip to content

Commit

Permalink
Merge pull request #2438 from bucketh3ad/fix_damage_text
Browse files Browse the repository at this point in the history
Fix damage text
  • Loading branch information
niamu committed Jun 11, 2015
2 parents 769b6af + 9972cf6 commit c676325
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ function Player:hurt(damage)
sound.playSfx( "damage" )
self.rebounding = true
self.invulnerable = true
self.showDamageText = true

local color = self.color
self.color = {255, 0, 0, 255}
Expand Down Expand Up @@ -664,6 +665,7 @@ function Player:hurt(damage)
Timer.add(1.5, function()
self.invulnerable = false
self.rebounding = false
self.showDamageText = false
self.color = color
end)

Expand Down Expand Up @@ -830,9 +832,9 @@ function Player:draw()
self.currently_held:draw()
end

local health = math.ceil(self.damageTaken * -1 / 10)

if self.rebounding and self.damageTaken > 0 then
if self.showDamageText then
local health = self.damageTaken
if health > 0 then health = health * -1 end
love.graphics.setColor( 255, 0, 0, 255 )
love.graphics.print(health, self.healthText.x, self.healthText.y, 0, 0.7, 0.7)
end
Expand Down

0 comments on commit c676325

Please sign in to comment.