Officer Johnson Posted January 27, 2018 Author Share Posted January 27, 2018 Hi everyone,This will be a simple tutorial to teach you how to add movement keys in your game.If you would like to use different keys then the arrow keys to move this tutorial is useful for that. This will be all client sided.Our first step will be to stop the chat box from picking up letter key presses.To do that we will need to:In modGeneral, Sub SetFocusOnChat, comment out the part where it sets focus on txtMyChat:```'frmMain.txtMyChat.SetFocus```Next head over to modGlobals and add: ```Public Chatting As Boolean```Next head over to frmMain find the event "picScreen's MouseDown: add the code:```Call SetFocusOnChatChatting = False```Next on frmMain go to txtMyChat in vb6 use the drop down at the right and select the "click" event. Then input the code:```Chatting = True```Now is the part where we add in the actual new keys for movement. If you don't want arrow key movement at all in your game you can just delete the arrow key movement code in the sub "CheckInputKeys"To add the new movement in the sub CheckInputKeys in under the arrow key movement code add:``` If Chatting = False Then 'Move Up (W) If GetKeyState(vbKeyW) < 0 Then DirUp = True DirDown = False DirLeft = False DirRight = False Exit Sub Else DirUp = False End If 'Move Right (D) If GetKeyState(vbKeyD) < 0 Then DirUp = False DirDown = False DirLeft = False DirRight = True Exit Sub Else DirRight = False End If 'Move down (S) If GetKeyState(vbKeyS) < 0 Then DirUp = False DirDown = True DirLeft = False DirRight = False Exit Sub Else DirDown = False End If 'Move left (A) If GetKeyState(vbKeyA) < 0 Then DirUp = False DirDown = False DirLeft = True DirRight = False Exit Sub Else DirLeft = False End If End If```**For this tutorial purpose i have set the new keys to WASD. But you can use any keys you want on the keyboard just change the appropriate letters in the code we just added.**That should be it if any questions let me know!Enjoy Link to comment Share on other sites More sharing options...
SolidLink Posted January 27, 2018 Share Posted January 27, 2018 Great tutorial! @Mohenjo-Daro You might want to check this one out :) Link to comment Share on other sites More sharing options...
Mohenjo Daro Posted January 27, 2018 Share Posted January 27, 2018 Rekt XD Yeah yeah yeah, I'll get to it later Link to comment Share on other sites More sharing options...
SolidLink Posted January 27, 2018 Share Posted January 27, 2018 @mohenjo-daro Better make it optional... **OR ELSE**-XD Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now