animations along path

This commit is contained in:
Thomas Rudin 2018-04-24 13:42:55 +02:00
parent b33fd0cb5e
commit 9656bc79db
2 changed files with 26 additions and 1 deletions

@ -10,11 +10,35 @@ local register_spacecannon = function(color, range, timeout, speed)
visual_size = {x=0.25, y=0.25},
textures = {entity_texture,entity_texture,entity_texture,entity_texture,entity_texture,entity_texture},
collisionbox = {-0.25,-0.25,-0.25, 0.25,0.25,0.25},
physical = false,
physical = false
},
timer = 0,
on_step = function(self, dtime)
self.timer = self.timer + dtime
local pos = self.object:getpos()
if self.timer > 0.5 then
-- add sparks along the way
minetest.add_particlespawner({
amount = 5,
time = 0.5,
minpos = pos,
maxpos = pos,
minvel = {x = -2, y = -2, z = -2},
maxvel = {x = 2, y = 2, z = 2},
minacc = {x = -3, y = -3, z = -3},
maxacc = {x = 3, y = 3, z = 3},
minexptime = 1,
maxexptime = 2.5,
minsize = 0.5,
maxsize = 0.75,
texture = "spacecannon_spark.png",
glow = 5
})
self.timer = 0
end
local node = minetest.get_node(pos)
if node.name == "air" then

@ -78,6 +78,7 @@ spacecannon.destroy = function(pos,range)
minsize = radius * 3,
maxsize = radius * 5,
texture = "spacecannon_spark.png",
glow = 5
})
minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = math.min(radius * 20, 128)})