Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function eventNewPlayer(name)
- for i,key in ipairs({40,83}) do
- tfm.exec.bindKeyboard(name,key,true,true)
- end
- end
- for name,player in pairs(tfm.get.room.playerList) do
- eventNewPlayer(name)
- end
- downx=0
- downy=0
- leftx=0
- lefty=0
- rightx=0
- righty=0
- upx=0
- upy=0
- bodyDef = {
- type = 0,
- width = 60,
- height = 10,
- foreground = false,
- friction = 0.3,
- restitution = 0.2,
- angle = 0,
- miceCollision = true,
- groundCollision = false,
- dynamic = false,
- fixedRotation = true,
- mass = 0,
- linearDamping = 0,
- angularDamping = 0
- }
- function eventKeyboard(name,key,down,x,y)
- -- up and down ground
- tfm.exec.removePhysicObject(1)
- bodyDef.type=0
- bodyDef.width=60
- bodyDef.height=10
- bodyDef.miceCollision = true
- test = tfm.exec.addPhysicObject(1, x, y+20, bodyDef)
- downx=x
- downy=y+20
- tfm.exec.removePhysicObject(4)
- test = tfm.exec.addPhysicObject(4, x, y-30, bodyDef)
- upx=x
- upy=y-30
- -- left and right ground
- tfm.exec.removePhysicObject(2)
- bodyDef.type=0
- bodyDef.width=10
- bodyDef.height=60
- bodyDef.miceCollision = true
- test = tfm.exec.addPhysicObject(2, x-25, y-5, bodyDef)
- leftx=x-25
- lefty=y-5
- tfm.exec.removePhysicObject(3)
- test = tfm.exec.addPhysicObject(3, x+25, y-5, bodyDef)
- rightx=x+25
- righty=y-5
- end
- function eventEmotePlayed(playerName,emote)
- if emote==3 then
- -- up and down ground
- tfm.exec.removePhysicObject(1)
- bodyDef.type=8
- bodyDef.width=60
- bodyDef.height=10
- bodyDef.miceCollision = false
- test = tfm.exec.addPhysicObject(1, downx, downy, bodyDef)
- tfm.exec.removePhysicObject(4)
- test = tfm.exec.addPhysicObject(4, upx, upy, bodyDef)
- -- left and right ground
- tfm.exec.removePhysicObject(2)
- bodyDef.type=8
- bodyDef.width=10
- bodyDef.height=60
- bodyDef.miceCollision = false
- test = tfm.exec.addPhysicObject(2, leftx, lefty, bodyDef)
- tfm.exec.removePhysicObject(3)
- test = tfm.exec.addPhysicObject(3, rightx, righty, bodyDef)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement