- --this makes the mob rotate and then die
- mob_register.manage_death_animation = function(self,dtime)
- if self.death_animation_timer >= 0 and self.dead == true then
- self.death_animation_timer = self.death_animation_timer - dtime
-
- local self_rotation = self.object:get_rotation()
-
- if self.death_rotation == "x" then
- if self_rotation.x < math.pi/2 then
- self_rotation.x = self_rotation.x + (dtime*2)
- self.object:set_rotation(self_rotation)
- end
- elseif self.death_rotation == "z" then
- if self_rotation.z < math.pi/2 then
- self_rotation.z = self_rotation.z + (dtime*2)
- self.object:set_rotation(self_rotation)
- end
- end
-
- --print(self.death_animation_timer)
- local currentvel = self.object:getvelocity()
- local goal = vector.new(0,0,0)
- local acceleration = vector.new(goal.x-currentvel.x,0,goal.z-currentvel.z)
- acceleration = vector.multiply(acceleration, 0.05)
- self.object:add_velocity(acceleration)
- self.object:set_animation({x=0,y=0}, 15, 0, true)
- end
- end
- return(mob_register)
+ --this makes the mob rotate and then die
+ mob_register.manage_death_animation = function(self,dtime)
+ if self.death_animation_timer >= 0 and self.dead == true then
+ self.death_animation_timer = self.death_animation_timer - dtime
+
+ local self_rotation = self.object:get_rotation()
+
+ if self.death_rotation == "x" then
+ if self_rotation.x < math.pi/2 then
+ self_rotation.x = self_rotation.x + (dtime*2)
+ self.object:set_rotation(self_rotation)
+ end
+ elseif self.death_rotation == "z" then
+ if self_rotation.z < math.pi/2 then
+ self_rotation.z = self_rotation.z + (dtime*2)
+ self.object:set_rotation(self_rotation)
+ end
+ end
+
+ --print(self.death_animation_timer)
+ local currentvel = self.object:get_velocity()
+ local goal = vector.new(0,0,0)
+ local acceleration = vector.new(goal.x-currentvel.x,0,goal.z-currentvel.z)
+ acceleration = vector.multiply(acceleration, 0.05)
+ self.object:add_velocity(acceleration)
+ self.object:set_animation(def.standing_frame, 15, 0, true)
+ end
+ end
+ return(mob_register)