1
0
Fork 0

Implement basic mob walking animation test

This commit is contained in:
jordan4ibanez 2021-04-15 15:55:10 -04:00
parent d07d0ae31c
commit 246bdf9707
4 changed files with 7 additions and 14 deletions

View File

@ -299,10 +299,9 @@ function mobs:register_mob(name, def)
pushable = def.pushable or true,
--j4i stuff
--automatic_rotate = 360,
yaw = 0,
automatic_face_movement_dir = def.rotate or 0, -- 0=front, 90=side, 180=back, 270=side2
automatic_face_movement_max_rotation_per_sec = 270, --degrees
automatic_face_movement_max_rotation_per_sec = 360, --degrees
backface_culling = true,
walk_timer = 0,
stand_timer = 0,

View File

@ -20,6 +20,8 @@ local do_states = function(self, dtime)
self.state_timer = math.random(0,2) + math.random()
--let's do a random state
self.yaw = (math_random() * (math.pi * 2))
mobs.set_animation(self, "walk")
end
mobs.set_velocity(self,1)
@ -46,7 +48,6 @@ local jump_check = function(self,dtime)
local test_dir = vector.add(pos,dir)
if minetest_get_item_group(minetest_get_node(test_dir).name, "solid") ~= 0 then
print("jump")
mobs.jump(self)
end
end

View File

@ -3,7 +3,7 @@ local math_sin = math.sin
local math_cos = math.cos
-- set defined animation
local set_animation = function(self, anim, fixed_frame)
mobs.set_animation = function(self, anim, fixed_frame)
if not self.animation or not anim then
return
end
@ -13,9 +13,8 @@ local set_animation = function(self, anim, fixed_frame)
self.animation.current = self.animation.current or ""
if (anim == self.animation.current
or not self.animation[anim .. "_start"]
or not self.animation[anim .. "_end"]) and self.state ~= "die" then
if (not self.animation[anim .. "_start"] or not self.animation[anim .. "_end"]) then
print("largablarga")
return
end
@ -37,12 +36,6 @@ local set_animation = function(self, anim, fixed_frame)
end
-- above function exported for mount.lua
function mobs:set_animation(self, anim)
set_animation(self, anim)
end
mobs.death_effect = function(pos, yaw, collisionbox, rotate)

View File

@ -194,7 +194,7 @@ mobs.mob_activate = function(self, staticdata, def, dtime)
self.object:set_properties(self)
--update_tag(self)
--set_animation(self, "stand")
--mobs.set_animation(self, "stand")
-- run on_spawn function if found
if self.on_spawn and not self.on_spawn_run then