plane: Added out of bounds-arrow
This commit is contained in:
parent
335b3078b8
commit
0270b68460
1 changed files with 15 additions and 0 deletions
|
@ -4,6 +4,7 @@ require 'settings'
|
||||||
require 'entities/debug'
|
require 'entities/debug'
|
||||||
require 'entities/animation'
|
require 'entities/animation'
|
||||||
require 'entities/ground'
|
require 'entities/ground'
|
||||||
|
require 'entities/arrow'
|
||||||
Matrix = require 'matrix'
|
Matrix = require 'matrix'
|
||||||
VectorLight = require 'hump/vector-light'
|
VectorLight = require 'hump/vector-light'
|
||||||
require 'utils'
|
require 'utils'
|
||||||
|
@ -131,6 +132,8 @@ Plane = Class{
|
||||||
|
|
||||||
self.health = PLANE_HEALTH
|
self.health = PLANE_HEALTH
|
||||||
self.powerupmode = nil
|
self.powerupmode = nil
|
||||||
|
|
||||||
|
self.outOfBoundsArrow = nil
|
||||||
end;
|
end;
|
||||||
|
|
||||||
receiveDamage = function(self, amount)
|
receiveDamage = function(self, amount)
|
||||||
|
@ -149,6 +152,10 @@ Plane = Class{
|
||||||
self:delete()
|
self:delete()
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
delete = function(self)
|
||||||
|
PhysicsEntity.delete(self)
|
||||||
|
end;
|
||||||
|
|
||||||
getGunPosition = function(self)
|
getGunPosition = function(self)
|
||||||
local x = self.body:getX()
|
local x = self.body:getX()
|
||||||
local y = self.body:getY()
|
local y = self.body:getY()
|
||||||
|
@ -210,6 +217,14 @@ Plane = Class{
|
||||||
if self.body:getY() < 0 then
|
if self.body:getY() < 0 then
|
||||||
self.motorPower = 0
|
self.motorPower = 0
|
||||||
coeff_multiplier = out_of_bounds_coeff_multiplier
|
coeff_multiplier = out_of_bounds_coeff_multiplier
|
||||||
|
|
||||||
|
if not self.outOfBoundsArrow then
|
||||||
|
self.outOfBoundsArrow = Arrow(0, 0, self.level, self.r, self.g, self.b)
|
||||||
|
end
|
||||||
|
self.outOfBoundsArrow:setX(self.body:getX())
|
||||||
|
elseif self.outOfBoundsArrow then
|
||||||
|
self.outOfBoundsArrow:delete()
|
||||||
|
self.outOfBoundsArrow = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.powerupmode ~= nil then
|
if self.powerupmode ~= nil then
|
||||||
|
|
Loading…
Reference in a new issue