Add death animation for sheep and ghosts

This commit is contained in:
BlockMen 2015-10-15 20:01:54 +02:00
parent 6bb5981c4f
commit 3b1a6ec719
7 changed files with 24 additions and 6774 deletions

View File

@ -27,7 +27,7 @@ local def = {
hp = 12, hp = 12,
lifetime = 300, -- 5 Minutes lifetime = 300, -- 5 Minutes
can_burn = true, can_burn = true,
can_fly = true, can_fly = true,
has_falldamage = false, has_falldamage = false,
has_kockback = true, has_kockback = true,
light = {min = 0, max = 8}, light = {min = 0, max = 8},
@ -43,16 +43,16 @@ local def = {
}, },
model = { model = {
mesh = "ghost.b3d", mesh = "creatures_ghost.b3d",
textures = {"creatures_ghost.png"}, textures = {"creatures_ghost.png"},
collisionbox = {-0.25, 0.2, -0.3, 0.25, 1.4, 0.3}, collisionbox = {-0.25, 0, -0.3, 0.25, 1.3, 0.3},
rotation = -90.0, rotation = -90.0,
animations = { animations = {
idle = {start = 0, stop = 80, speed = 15}, idle = {start = 0, stop = 80, speed = 15},
fly = {start = 168, stop = 188, speed = 12}, fly = {start = 102, stop = 122, speed = 12},
fly_2 = {start = 168, stop = 188, speed = 10}, fly_2 = {start = 102, stop = 122, speed = 10},
attack = {start = 168, stop = 188, speed = 25}, attack = {start = 102, stop = 122, speed = 25},
-- death death = {start = 81, stop = 101, speed = 28, loop = false, duration = 1.32},
}, },
}, },

Binary file not shown.

View File

@ -42,7 +42,7 @@ local function shear(self, drop_count, sound)
if sound then if sound then
core.sound_play("creatures_shears", {pos = pos, gain = 1, max_hear_distance = 10}) core.sound_play("creatures_shears", {pos = pos, gain = 1, max_hear_distance = 10})
end end
self.object:set_properties({textures = {"creatures_sheep_shaved.png"}}) self.object:set_properties({textures = {"creatures_sheep.png"}})
creatures.dropItems(pos, {{"wool:white", drop_count}}) creatures.dropItems(pos, {{"wool:white", drop_count}})
end end
end end
@ -61,24 +61,24 @@ local def = {
}, },
model = { model = {
mesh = "creatures_sheep.x", mesh = "creatures_sheep.b3d",
textures = {"creatures_sheep.png"}, textures = {"creatures_sheep.png^creatures_sheep_white.png"},
collisionbox = {-0.5, -0.01, -0.55, 0.5, 1.1, 0.55}, collisionbox = {-0.5, -0.01, -0.55, 0.5, 1.1, 0.55},
rotation = -90.0, rotation = -90.0,
animations = { animations = {
idle = {start = 0, stop = 80, speed = 15}, idle = {start = 1, stop = 60, speed = 15},
walk = {start = 81, stop = 100, speed = 18}, walk = {start = 81, stop = 101, speed = 18},
walk_long = {start = 81, stop = 100, speed = 18}, walk_long = {start = 81, stop = 101, speed = 18},
eat = {start = 107, stop = 185, speed = 12, loop = false}, eat = {start = 107, stop = 170, speed = 12, loop = false},
follow = {start = 81, stop = 100, speed = 15}, follow = {start = 81, stop = 101, speed = 15},
--death = {start = 0, stop = 80, speed = 15, loop = false, duration = 1}, death = {start = 171, stop = 191, speed = 32, loop = false, duration = 2.52},
}, },
}, },
sounds = { sounds = {
on_damage = {name = "creatures_sheep", gain = 1.0, distance = 10}, on_damage = {name = "creatures_sheep", gain = 1.0, distance = 10},
on_death = {}, on_death = {name = "creatures_sheep", gain = 1.0, distance = 10},
swim = {name = "creatures_splash", gain = 1.0, distance = 10,}, -- played whenever moving in(to) water swim = {name = "creatures_splash", gain = 1.0, distance = 10,},
random = { random = {
idle = {name = "creatures_sheep", gain = 0.6, distance = 10, time_min = 23}, idle = {name = "creatures_sheep", gain = 0.6, distance = 10, time_min = 23},
}, },
@ -144,7 +144,7 @@ local def = {
on_activate = function(self, staticdata) on_activate = function(self, staticdata)
if self.has_wool == false then if self.has_wool == false then
self.object:set_properties({textures = {"creatures_sheep_shaved.png"}}) self.object:set_properties({textures = {"creatures_sheep.png"}})
end end
end, end,
@ -156,9 +156,10 @@ local def = {
self.target = clicker self.target = clicker
self.mode = "follow" self.mode = "follow"
self.modetimer = 0 self.modetimer = 0
if not self.tamed then
self.fed_cnt = (self.fed_cnt or 0) + 1 if not self.tamed then
end self.fed_cnt = (self.fed_cnt or 0) + 1
end
-- play eat sound? -- play eat sound?
item:take_item() item:take_item()
elseif name == "creatures:shears" and self.has_wool then elseif name == "creatures:shears" and self.has_wool then
@ -183,7 +184,7 @@ local def = {
if self.last_mode == "eat" and self.modetimer == 0 and self.regrow_wool then if self.last_mode == "eat" and self.modetimer == 0 and self.regrow_wool then
self.has_wool = true self.has_wool = true
self.regrow_wool = nil self.regrow_wool = nil
self.object:set_properties({textures = {"creatures_sheep.png"}}) self.object:set_properties({textures = {"creatures_sheep.png^creatures_sheep_white.png"}})
end end
if self.fed_cnt and self.fed_cnt > 4 then if self.fed_cnt and self.fed_cnt > 4 then
self.tamed = true self.tamed = true

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB