tank
This commit is contained in:
@@ -99,6 +99,24 @@ function Player:changeToRunState(direction)
|
||||
end
|
||||
end
|
||||
|
||||
function Player:boom(collisionObject)
|
||||
Player.dead = true
|
||||
self:changeState("boom")
|
||||
|
||||
local particleB = ParticlePoly(self.x, self.y)
|
||||
particleB:setThickness(2)
|
||||
particleB:setAngular(-15, 15)
|
||||
particleB:setSize(1, 2)
|
||||
particleB:setSpeed(1, 3)
|
||||
particleB:setMode(Particles.modes.STAY)
|
||||
particleB:setBounds(0, 0, 400, 240)
|
||||
particleB:setColour(Graphics.kColorXOR)
|
||||
particleB:add(20)
|
||||
if collisionObject then
|
||||
collisionObject:remove()
|
||||
end
|
||||
end
|
||||
|
||||
function Player:handleMovementAndCollisions()
|
||||
if Player.dead then
|
||||
return
|
||||
@@ -134,23 +152,24 @@ function Player:handleMovementAndCollisions()
|
||||
end
|
||||
|
||||
if collisionTag == 3 then -- Ground
|
||||
Player.dead = true
|
||||
self:changeState("boom")
|
||||
self:boom()
|
||||
return
|
||||
elseif collisionTag == 154 then -- Baleba
|
||||
Player.dead = true
|
||||
self:changeState("boom")
|
||||
-- self:boom(collisionObject)
|
||||
return
|
||||
elseif collisionTag == 2 then -- Tank
|
||||
self:boom()
|
||||
|
||||
local particleB = ParticlePoly(self.x, self.y)
|
||||
particleB:setThickness(2)
|
||||
particleB:setAngular(-15, 15)
|
||||
particleB:setSize(1, 2)
|
||||
particleB:setSpeed(1, 3)
|
||||
particleB:setMode(Particles.modes.STAY)
|
||||
particleB:setBounds(0, 0, 400, 240)
|
||||
particleB:setColour(Graphics.kColorXOR)
|
||||
particleB:add(20)
|
||||
collisionObject:remove()
|
||||
local particleC = ParticlePoly(collisionObject.x, collisionObject.y)
|
||||
particleC:setThickness(5)
|
||||
particleC:setAngular(-15, 15)
|
||||
particleC:setSize(1, 5)
|
||||
particleC:setSpeed(1, 3)
|
||||
particleC:setMode(Particles.modes.STAY)
|
||||
particleC:setBounds(0, 0, 400, 240)
|
||||
particleC:setColour(Graphics.kColorXOR)
|
||||
particleC:add(50)
|
||||
collisionObject:fadeout()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user