diff --git a/bigballmode.lua b/bigballmode.lua index 88dad01..a39e291 100644 --- a/bigballmode.lua +++ b/bigballmode.lua @@ -13,6 +13,10 @@ BigBallMode = Class{ PowerUpMode.update(self, dt) end; + draw = function(self, x, y) + PowerUpMode.draw(self, x, y) + end; + activate = function(self, plane) PowerUpMode.activate(self, plane) plane.machinegun:setType("bigball") @@ -20,6 +24,5 @@ BigBallMode = Class{ deactivate = function(self) PowerUpMode.deactivate(self) - self.plane.machinegun:setType(PLANE_DEFAULT_GUN) end; } \ No newline at end of file diff --git a/chaingunmode.lua b/chaingunmode.lua index 2eb1802..4d7c14a 100644 --- a/chaingunmode.lua +++ b/chaingunmode.lua @@ -13,6 +13,10 @@ ChaingunMode = Class{ PowerUpMode.update(self, dt) end; + draw = function(self, x, y) + PowerUpMode.draw(self, x, y) + end; + activate = function(self, plane) PowerUpMode.activate(self, plane) plane.machinegun:setType("chaingun") @@ -20,6 +24,5 @@ ChaingunMode = Class{ deactivate = function(self) PowerUpMode.deactivate(self) - self.plane.machinegun:setType(PLANE_DEFAULT_GUN) end; } \ No newline at end of file diff --git a/entities/plane.lua b/entities/plane.lua index e9ca192..e0d9167 100644 --- a/entities/plane.lua +++ b/entities/plane.lua @@ -335,6 +335,10 @@ Plane = Class{ love.graphics.pop() drawDebug(self.debugVectors) + + if self.powerupmode ~= nil then + self.powerupmode:draw(self.body:getX(), self.body:getY()) + end end end; diff --git a/level_state.lua b/level_state.lua index 4fb5941..920bde7 100644 --- a/level_state.lua +++ b/level_state.lua @@ -191,8 +191,10 @@ function begin_contact(a, b, coll) if other:isinstance(gun['projectile']) and plane.health > 0 then plane:receiveDamage(gun['damage']) + local shooter = other:getOwner():getOwner() + shooter:addScore(HIT_SCORE) if plane.health == 0 then - other:getOwner():getOwner():addScore(KILL_SCORE) + shooter:addScore(KILL_SCORE) end end end diff --git a/powerupmode.lua b/powerupmode.lua index e58bf87..658ff39 100644 --- a/powerupmode.lua +++ b/powerupmode.lua @@ -10,7 +10,7 @@ PowerUpMode = Class{ end; update = function(self, dt) - if active then + if self.active then self.age = self.age + dt end @@ -20,11 +20,11 @@ PowerUpMode = Class{ end; draw = function(self, x, y) - local age = self.age / self.duration - local start_color = {0, 255, 0} - local end_color = {255, 0, 0} + local age_ratio = self.age / self.duration + local start_color = {255, 0, 0} + local end_color = {0, 255, 0} love.graphics.setColor(colorSlide(start_color, end_color, age_ratio)) - love.graphics.rectangle("fill", self.x, self.y + 60, 50, 5) + love.graphics.rectangle("fill", x, y + 60, 50 * (1 - age_ratio), 5) end; activate = function(self, plane) @@ -35,5 +35,6 @@ PowerUpMode = Class{ deactivate = function(self) self.plane.powerupmode = nil + self.plane.machinegun:setType(PLANE_DEFAULT_GUN) end; } \ No newline at end of file diff --git a/settings.lua b/settings.lua index fa7d83c..65d4143 100644 --- a/settings.lua +++ b/settings.lua @@ -35,7 +35,8 @@ SCOREBOARD_MARGIN = 20 ENGINE_MAX = 1000 -INITIAL_PLANE_SPEED = 500 +INITIAL_PLANE_SPEED = 1000 +HIT_SCORE = 1 KILL_SCORE = 10 SUICIDE_SCORE = -2