Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- doll = "Koalla"
- god = "Bunnywooou"
- -- Binding the keyboard for god(you)
- -- 73 is I, the key for Up.
- -- 75 is K, the key for Down
- -- 74 is J, the key for Left.
- -- 76 is L, the key for Right.
- for name in pairs(tfm.get.room.playerList) do
- -- Instead of binding each key seperately, we put them all in a group.
- for keys, k in pairs({73, 74, 75, 76}) do
- --And now the keys are binded!
- tfm.exec.bindKeyboard(god, k, true, true)
- end
- end
- function eventKeyboard(god, key, down, x, y)
- if key == 73 then
- --Moves the player Up by 50 pixels
- tfm.exec.movePlayer(doll, 0, 0, true, 0, -50, false)
- elseif key == 75 then
- -- Moves the player Down by 40 pixels
- tfm.exec.movePlayer(doll, 0, 0, true, 0, 40, false)
- elseif key == 74 then
- -- Moves the player Left by 40 pixels
- tfm.exec.movePlayer(doll, 0, 0, true, -40, 0, false)
- elseif key == 76 then
- -- Moves the player Right by 40 pixels
- tfm.exec.movePlayer(doll, 0, 0, true, 40, 0, false)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement