Add Panike

master
Lean Rada 2015-01-19 22:30:45 +08:00
parent 45608a927e
commit 947df589bb
7 changed files with 12 additions and 15 deletions

View File

@ -129,7 +129,6 @@ function director:spawn_monsters()
minetest.chat_send_all("Spawn " .. monster.description .. " (" .. group_size .. " " ..
monster.name .. ") at " .. minetest.pos_to_string(pos))
end
mob_count = mob_count + group_size
repeat
minetest.after(group_size * (math.random() * 0.2), function()
local obj = minetest.add_entity(pos, monster.name)

View File

@ -1,5 +1,5 @@
defense = {}
defense.debug = false
defense.debug = true
local modpath = minetest.get_modpath("defense")
local function dofile2(file)

View File

@ -258,7 +258,7 @@ function mobs.move_method:air(dtime, destination)
end
self.object:setyaw(yaw + yaw_delta * (1-t))
if speed > self.move_speed * 0.1 then
if speed > self.move_speed * 0 then
self:set_animation("move", {"move_attack"})
else
self:set_animation("idle", {"attack", "move_attack"})

View File

@ -1,19 +1,16 @@
defense.mobs.register_mob("defense:paniki", {
hp_max = 3,
collisionbox = {-0.4,-0.01,-0.4, 0.4,0.8,0.4},
visual_size = {x=1.0, y=1.0},
-- mesh = "defense_paniki.b3d",
visual = "sprite",
collisionbox = {-0.4,-0.4,-0.4, 0.4,0.4,0.4},
visual_size = {x=4.0, y=4.0},
mesh = "defense_paniki.b3d",
textures = {"defense_paniki.png"},
makes_footstep_sound = false,
animation = {
-- idle = {a=0, b=39, rate=30},
-- jump = {a=40, b=49, rate=15},
-- fall = {a=50, b=64, rate=20},
-- attack = {a=65, b=72, rate=15},
-- move = {a=75, b=99, rate=40},
-- move_attack = {a=100, b=113, rate=20},
idle = {a=0, b=29, rate=50},
attack = {a=60, b=89, rate=50},
move = {a=30, b=59, rate=75},
move_attack = {a=60, b=89, rate=75},
},
mass = 1,

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -1,8 +1,9 @@
local rate = 0.1 -- hp per second
regeneration = {}
regeneration.rate = 0.1 -- hp per second
local counter = 0
minetest.register_globalstep(function(dtime)
counter = counter + dtime * rate
counter = counter + dtime * regeneration.rate
if counter >= 1 then
for _,p in ipairs(minetest.get_connected_players()) do
while counter >= 1 do