Skip to content

Commit

Permalink
Boss glows when taking damage now
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonLarsen committed Feb 20, 2013
1 parent 323b796 commit b80f9a6
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
25 changes: 20 additions & 5 deletions boss.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ function Boss.create(x,y)
local self = setmetatable({}, Boss)

self.alive = true
self.hit = false
self.x, self.y = x,y
self.xspeed, self.yspeed = 0,0
self.time = self.IDLE_TIME
Expand Down Expand Up @@ -82,13 +83,26 @@ function Boss:draw()
self.flx = math.floor(self.x)
self.fly = math.floor(self.y)

if self.state == BS_IDLE then
self.anims[BS_JUMP]:draw(self.flx, self.fly, 0, self.dir, 1, 27, 64, 1)
elseif self.state == BS_FLY then
self.anims[BS_LAND]:draw(self.flx, self.fly, 0, self.dir, 1, 27, 64, 1)
if self.hit == false then
if self.state == BS_IDLE then
self.anims[BS_JUMP]:draw(self.flx, self.fly, 0, self.dir, 1, 27, 64, 1)
elseif self.state == BS_FLY then
self.anims[BS_LAND]:draw(self.flx, self.fly, 0, self.dir, 1, 27, 64, 1)
else
self.anim:draw(self.flx, self.fly, 0, self.dir, 1, 27, 64)
end
else
self.anim:draw(self.flx, self.fly, 0, self.dir, 1, 27, 64)
if self.state == BS_IDLE then
self.anims[BS_JUMP]:draw(self.flx, self.fly, 0, self.dir, 1, 27, 64, 1, img.boss_jump_hit)
elseif self.state == BS_FLY then
self.anims[BS_LAND]:draw(self.flx, self.fly, 0, self.dir, 1, 27, 64, 1, img.boss_land_hit)
elseif self.state == BS_JUMP then
self.anim:draw(self.flx, self.fly, 0, self.dir, 1, 27, 64, nil, img.boss_jump_hit)
elseif self.state == BS_LAND then
self.anim:draw(self.flx, self.fly, 0, self.dir, 1, 27, 64, nil, img.boss_land_hit)
end
end
self.hit = false
end

function Boss:collideBox(bbox)
Expand All @@ -111,4 +125,5 @@ end

function Boss:shot(dt,dir)
self.health = self.health - dt
self.hit = true
end
Binary file added data/boss_jump_hit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/boss_land_hit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions map.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function Map.create(section, level)
else
self.type = MT_NORMAL
end
self.type = MT_BOSS

if self.type == MT_NORMAL then
file = love.filesystem.load("maps/base.lua")()
Expand Down
2 changes: 1 addition & 1 deletion resources.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ local IMAGE_FILES = {
"enemy_angryjumper_hit", "enemy_angryjumper_jump",
"enemy_volcano_run", "enemy_volcano_shoot", "enemy_volcano_hit",
"enemy_angryvolcano_run", "enemy_angryvolcano_shoot", "enemy_angryvolcano_hit", "enemy_fireball",
"boss_jump", "boss_land",
"boss_jump", "boss_land", "boss_jump_hit", "boss_land_hit",

"human_1_run", "human_2_run", "human_3_run", "human_4_run",
"human_1_carry_left", "human_2_carry_left", "human_3_carry_left", "human_4_carry_left",
Expand Down

0 comments on commit b80f9a6

Please sign in to comment.