Skip to content
Browse files

Added crate powerup, made turret powerup respect damage

added a 'crate' power up in three levels, granting
addition score (25, 50, and 100pt).
the 'turret' powerup now creates a turret roughly as damaged as the
powerup itself was, thus a pickup damaged to 50% health will yield a
turret that is half dead.
  • Loading branch information...
1 parent 42ffced commit 507c8f28b28dc00058fb55de88250f3b08be3a32 @Textmode Textmode committed Aug 31, 2012
Showing with 24 additions and 7 deletions.
  1. BIN gfx/pu_crate01.png
  2. BIN gfx/pu_crate02.png
  3. BIN gfx/pu_crate03.png
  4. +24 −7 powerup.lua
View
BIN gfx/pu_crate01.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN gfx/pu_crate02.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN gfx/pu_crate03.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
31 powerup.lua
@@ -12,19 +12,23 @@ setmetatable(_M, _MMT)
-------------------------------------------------------------------------
local Image = love.graphics.newImage
icons = {
- generic = Image "gfx/RepairPack.png";
- heal10 = Image "gfx/RepairPack.png";
- heal30 = Image "gfx/RepairPack2.png";
- heal60 = Image "gfx/RepairPack3.png";
- heal100 = Image "gfx/RepairPack4.png";
- turret = Image "gfx/pu_turret.png";
+ generic = Image "gfx/pu_crate01.png";
+ heal10 = Image "gfx/RepairPack.png";
+ heal30 = Image "gfx/RepairPack2.png";
+ heal60 = Image "gfx/RepairPack3.png";
+ heal100 = Image "gfx/RepairPack4.png";
+ turret = Image "gfx/pu_turret.png";
+ crate_low = Image "gfx/pu_crate01.png";
+ crate_mid = Image "gfx/pu_crate02.png";
+ crate_high = Image "gfx/pu_crate03.png";
}
-------------------------------------------------------------------------
function _M.getRandomPowerup(t)
local p = _M.new(t)
- local set = {'heal10', 'heal30', 'heal60', 'heal100', 'turret'}
+ local set = {'heal10', 'heal30', 'heal60', 'heal100', 'turret',
+ 'crate_high', 'crate_mid', 'crate_low'}
p.effect = set[math.random(#set)]
return _M.new(p)
end
@@ -74,9 +78,22 @@ function _M:doeffect(e)
e:heal(e.shieldmax*impact)
elseif self.effect == 'turret' then
local t = turret.new{owner = e}
+ t.shield = t.shieldmax * impact
e:addentity(t)
local tau = math.pi*2
t.hardpoint = math.random() * tau
+ elseif self.effect == 'crate_low' then
+ if e.score then
+ e.score = e.score + (25 * impact)
+ end
+ elseif self.effect == 'crate_mid' then
+ if e.score then
+ e.score = e.score + (50 * impact)
+ end
+ elseif self.effect == 'crate_high' then
+ if e.score then
+ e.score = e.score + (100 * impact)
+ end
else
print("Unknown powerup effect", self.effect)
end

0 comments on commit 507c8f2

Please sign in to comment.
Something went wrong with that request. Please try again.