Skip to content
Snippets Groups Projects
Commit 8955af2c authored by D00Med's avatar D00Med
Browse files

butterfly improvements and '=' fix

parent ac024f00
No related branches found
No related tags found
No related merge requests found
......@@ -8,11 +8,11 @@ dofile(minetest.get_modpath("dmobs").."/api.lua")
-- Enable dragons (disable to remove tamed dragons and dragon bosses)
dmobs.dragons = minetest.setting_getbool("dmobs.dragons")
if dmobs.dragons = nil then
if dmobs.dragons == nil then
dmobs.dragons = true
end
dmobs.regulars = minetest.setting_getbool("dmobs.regulars")
if dmobs.regulars = nil then
if dmobs.regulars == nil then
dmobs.regulars = true
end
......
......@@ -6,25 +6,30 @@ minetest.register_abm({
interval = 10.0,
chance = 10,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.env:add_entity({x=pos.x,y=pos.y,z=pos.z}, "dmobs:butterfly")
minetest.env:add_entity({x=pos.x,y=pos.y+0.3,z=pos.z}, "dmobs:butterfly")
end
})
minetest.register_entity("dmobs:butterfly", {
visual = "sprite",
visual = "mesh",
mesh = "butterfly.b3d",
physical = true,
textures = {"dmobs_butterfly.png",},
visual_size = {x=0.2, y=0.2},
visual_size = {x=0.3, y=0.3},
on_activate = function(self)
num = math.random(1,4)
self.object:set_properties({textures = {"dmobs_butterfly"..num..".png",},})
minetest.after(5, function()
self.object:set_animation({x=1, y=10}, 20, 0)
self.object:setyaw(math.pi+num)
minetest.after(10, function()
self.object:remove()
end)
end,
on_step = function(self)
local pos = self.object:getpos()
local vec = self.object:getvelocity()
local num = math.random(-math.pi, math.pi)
self.object:setyaw(math.pi+num)
self.object:setvelocity({x=-math.sin(12*pos.y), y=math.cos(12*pos.x), z=-math.sin(12*pos.y)})
self.object:setacceleration({x=-math.sin(6*vec.y), y=math.cos(6*vec.x), z=-math.sin(6*vec.y)})
end,
......
File added
textures/dmobs_butterfly1.png

497 B | W: | H:

textures/dmobs_butterfly1.png

440 B | W: | H:

textures/dmobs_butterfly1.png
textures/dmobs_butterfly1.png
textures/dmobs_butterfly1.png
textures/dmobs_butterfly1.png
  • 2-up
  • Swipe
  • Onion skin
textures/dmobs_butterfly2.png

514 B | W: | H:

textures/dmobs_butterfly2.png

448 B | W: | H:

textures/dmobs_butterfly2.png
textures/dmobs_butterfly2.png
textures/dmobs_butterfly2.png
textures/dmobs_butterfly2.png
  • 2-up
  • Swipe
  • Onion skin
textures/dmobs_butterfly3.png

536 B | W: | H:

textures/dmobs_butterfly3.png

445 B | W: | H:

textures/dmobs_butterfly3.png
textures/dmobs_butterfly3.png
textures/dmobs_butterfly3.png
textures/dmobs_butterfly3.png
  • 2-up
  • Swipe
  • Onion skin
textures/dmobs_butterfly4.png

490 B | W: | H:

textures/dmobs_butterfly4.png

454 B | W: | H:

textures/dmobs_butterfly4.png
textures/dmobs_butterfly4.png
textures/dmobs_butterfly4.png
textures/dmobs_butterfly4.png
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment