Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Joint drawing [v0.9]
- !color ff00ff => changer la couleur (mettez un code hexadecimal)
- !alpha xx => changer la transparence de ses joints (entre 0 et 1)
- !line xx => Changer l'épaisseur de ses joints
- ]]--
- function init ()
- info = {}
- for name in pairs(tfm.get.room.playerList) do eventNewPlayer(name) end
- eventNewGame()
- end
- function eventNewPlayer(name)
- system.bindMouse(name, true)
- tfm.exec.bindKeyboard(name, 8, true, true)
- info[name] = { prop = { color=0xffffff, alpha=0.8, line=10, foreground=true}}
- end
- function eventMouse (name, x, y)
- if info[name].prop.point1 then
- info[name].prop.point2 = tostring(x)..','..tostring(y)
- addJoint(name)
- info[name].prop.point1 = nil
- else
- info[name].prop.point1 = tostring(x)..','..tostring(y)
- end
- end
- function eventKeyboard(name, key, down, x, y)
- if key == 8 then delJoint(#joint) end
- end
- function eventChatCommand(name, command)
- if command:sub(0,5) == "color" then
- info[name].prop.color = tonumber('0x'..command:sub(7))
- elseif command:sub(0,4) == "line" then
- info[name].prop.line = tonumber(command:sub(6))
- elseif command:sub(0,5) == "alpha" then
- info[name].prop.alpha = tonumber(command:sub(7))
- end
- end
- function addJoint (name)
- table.insert(joint, info[name].prop)
- tfm.exec.addJoint (#joint, 1, 1, info[name].prop)
- end
- function delJoint(id)
- if id ~= 0 then
- tfm.exec.removeJoint (id)
- table.remove(joint, id)
- end
- end
- function eventNewGame ()
- joint = {}
- tfm.exec.addPhysicObject(1, -500,-500, {['type']=1})
- end
- init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement