[Moduł]WASD Walker
[Moduł]WASD Walker
Witam.
Chciałbym wam przedstawić Moduł do OTClienta, który pozwoli nam chodzić nie tylko strzałkami ale także klawiszami WASD.
1.Wchodzimy w \modules\game_console i otwieramy plik console.lua:
1a. Znajdź :
2. Następnie w pliku console.otui znajdź:
Gotowe, powinno wszystko działać.
Pozdrawiam.
Chciałbym wam przedstawić Moduł do OTClienta, który pozwoli nam chodzić nie tylko strzałkami ale także klawiszami WASD.
1.Wchodzimy w \modules\game_console i otwieramy plik console.lua:
1a. Znajdź :
- Kod:
channels = {}
- Kod:
consoleWalk = consolePanel:getChildById('walk')
- Kod:
function Walk()
if consoleWalk:isChecked() then
consoleTextEdit:setVisible(false)
consoleTextEdit:setText("")
g_keyboard.bindKeyPress("W", function() g_game.walk(North) end)
g_keyboard.bindKeyPress("D", function() g_game.walk(East) end)
g_keyboard.bindKeyPress("S", function() g_game.walk(South) end)
g_keyboard.bindKeyPress("A", function() g_game.walk(West) end)
else
consoleTextEdit:setVisible(true)
consoleTextEdit:setText("")
g_keyboard.unbindKeyPress("W")
g_keyboard.unbindKeyPress("D")
g_keyboard.unbindKeyPress("S")
g_keyboard.unbindKeyPress("A")
end
end
2. Następnie w pliku console.otui znajdź:
- Kod:
Panel
id: consolePanel
anchors.fill: parent
- Kod:
CheckBox
id: walk
anchors.left: parent.left
anchors.top: parent.top
margin-left: 13
margin-top: 8
@onCheckChange: Walk()
- Kod:
TabButton
id: prevChannelButton
icon: icons/leftarrow.png
anchors.left: parent.left
anchors.top: parent.top
margin-left: 6
margin-top: 6
- Kod:
TabButton
id: prevChannelButton
icon: /images/game/console/leftarrow
anchors.left: walk.right
anchors.top: parent.top
margin-left: 3
margin-top: 6
Gotowe, powinno wszystko działać.
Pozdrawiam.
Permissions in this forum:
Nie możesz odpowiadać w tematach
|
|