Guest User

Kick prevention

a guest
Jun 26th, 2016
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. ;============================== Supporting functions and sections ==============================
  2.  
  3. ;Blocks direction (WASD) keys
  4. BlockDirectionInputs(state)
  5. {
  6. static keys
  7. keys=w,a,s,d
  8. Loop,Parse,keys, `,
  9. Hotkey, *%A_LoopField%, KeyboardDummyLabel, %state%
  10. Return
  11. KeyboardDummyLabel: ; hotkeys need a label, so give them one that do nothing
  12. Return
  13. }
  14.  
  15. ;disables accidental kicks
  16. Attack:
  17. Send {w up}{a up}{s up}{d up} ;stops your movement
  18. BlockDirectionInputs("on") ;disables WASD keys
  19. Send {Z down}
  20. sleep 31
  21. Send {Z up}
  22. Sleep 50 ;at this time you should be at the very start of your attack animation, meaning you cant kick anymore.
  23. BlockDirectionInputs("off") ;reenables WASD so you can do the pivoting attack (attack in other direction and finish it in your)
  24. SynchronizeDirection()
  25. return
  26.  
  27. ;This is the routine that synchronizes your pressed WASD keys with their "electronic" counter parts
  28. SynchronizeDirection()
  29. {
  30. dir=false
  31. if (GetKeyState("W", "P")){
  32. Send {W down}
  33. dir=true
  34. }
  35. if (GetKeyState("A", "P")){
  36. Send {A down}
  37. dir=true
  38. }
  39. if (GetKeyState("D", "P")){
  40. Send {D down}
  41. dir=true
  42. }
  43. if (GetKeyState("S", "P")){
  44. Send {S down}
  45. dir=true
  46. }
  47. return dir
  48. }
  49.  
  50.  
  51.  
  52. ;============================== Main Script ==============================
  53.  
  54. LButton::
  55. Gosub Attack ;Activates the attack function
  56. return
  57.  
  58. LButton up:: ;makes sure there is no action at the end of the click
  59. return
Advertisement
Add Comment
Please, Sign In to add comment