add arrow wiggle when hit node
This commit is contained in:
parent
9ad939cd1c
commit
1b635974ab
7
api.lua
7
api.lua
|
@ -1262,7 +1262,8 @@ function XBowsEntityDef.on_step(self, selfObj, dtime)
|
|||
|
||||
---Wiggle
|
||||
local rotation = selfObj.object:get_rotation()
|
||||
local wiggle_timer = 0.05
|
||||
local wiggle_timer_const = 0.05
|
||||
local wiggle_timer = 0
|
||||
|
||||
for i = 1, 3 do
|
||||
local rotx = rotation.x + math.random(10, 20) / 100
|
||||
|
@ -1281,11 +1282,11 @@ function XBowsEntityDef.on_step(self, selfObj, dtime)
|
|||
_rotation = rotation
|
||||
end
|
||||
|
||||
wiggle_timer = wiggle_timer + wiggle_timer_const
|
||||
|
||||
minetest.after(wiggle_timer, function(v_object)
|
||||
selfObj.object:set_rotation(_rotation)
|
||||
end, selfObj.object, wiggle_timer)
|
||||
|
||||
wiggle_timer = wiggle_timer + wiggle_timer
|
||||
end
|
||||
|
||||
---API callbacks
|
||||
|
|
Ŝarĝante…
Reference in New Issue