Add sprint (#8)
This commit is contained in:
parent
68457b6b66
commit
dcadd7744f
1
init.lua
1
init.lua
@ -66,6 +66,7 @@ dofile(MP.."/register_nodes.lua")
|
|||||||
dofile(MP.."/shop.lua")
|
dofile(MP.."/shop.lua")
|
||||||
dofile(MP .. "/extender.lua")
|
dofile(MP .. "/extender.lua")
|
||||||
dofile(MP .. "/tools.lua")
|
dofile(MP .. "/tools.lua")
|
||||||
|
dofile(MP .. "/sprint.lua")
|
||||||
|
|
||||||
----------------------
|
----------------------
|
||||||
-- Helper Functions --
|
-- Helper Functions --
|
||||||
|
16
sprint.lua
Normal file
16
sprint.lua
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
local players = {}
|
||||||
|
|
||||||
|
minetest.register_globalstep(function(dtime)
|
||||||
|
for _,player in ipairs(minetest.get_connected_players()) do
|
||||||
|
local name = player:get_player_name()
|
||||||
|
players[name] = true
|
||||||
|
local control = player:get_player_control()
|
||||||
|
local sprint = control.aux1 and control.up
|
||||||
|
if sprint and players[name] then
|
||||||
|
player:set_physics_override({speed = 1.2})
|
||||||
|
else
|
||||||
|
player:set_physics_override({speed = 1})
|
||||||
|
players[name] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
Loading…
x
Reference in New Issue
Block a user