mirror of
https://github.com/APercy/airutils.git
synced 2025-03-15 08:01:22 +00:00
check obj exists
This commit is contained in:
parent
27e140ae6d
commit
e1bbf50819
1 changed files with 7 additions and 2 deletions
|
@ -37,6 +37,7 @@ function airutils.on_deactivate(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
function airutils.on_activate(self, staticdata, dtime_s)
|
function airutils.on_activate(self, staticdata, dtime_s)
|
||||||
|
if not self.object then return end
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
airutils.actfunc(self, staticdata, dtime_s)
|
airutils.actfunc(self, staticdata, dtime_s)
|
||||||
self._flap = false
|
self._flap = false
|
||||||
|
@ -136,6 +137,8 @@ function airutils.on_step(self,dtime,colinfo)
|
||||||
self.colinfo = colinfo
|
self.colinfo = colinfo
|
||||||
self.height = airutils.get_box_height(self)
|
self.height = airutils.get_box_height(self)
|
||||||
|
|
||||||
|
if not self.object then return end
|
||||||
|
|
||||||
-- physics comes first
|
-- physics comes first
|
||||||
local vel = self.object:get_velocity()
|
local vel = self.object:get_velocity()
|
||||||
local pos = self.object:get_pos()
|
local pos = self.object:get_pos()
|
||||||
|
@ -165,8 +168,10 @@ function airutils.on_step(self,dtime,colinfo)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.hp_max <= 0 then
|
if self.hp_max then
|
||||||
airutils.destroy(self)
|
if self.hp_max <= 0 then
|
||||||
|
airutils.destroy(self)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:physics()
|
self:physics()
|
||||||
|
|
Loading…
Add table
Reference in a new issue