Simple WASD-key Functionality

A simple guide to adding basic WASD-key movement to RMXP

  1. Radical Raptr
    Hello there! I'm providing a simple guide on how to include WASD-key functionality to your fan-game!

    If you've played any game on the PC, you'll know that one key feature is that movement tends to default to using WASD and not the arrow keys, so I've created a guide on how to include WASD as an alternative (and not as a replacement for those who are used to arrow keys!)

    I really hope games start including this feature, along with keyboard text entry. It helps makes fan-games more localized to PC's rather than sticking to outdated methods! It just feels more natural to have these little quality of life fixes.

    Something to note is that you can edit controls, but while changing WASD to include movement is essential, there's more to it than that; otherwise you'll never be able to A or D when using the keyboard text input feature, and that's not good! using keyboard for text entry would inherently mess with WASD keys, as the A and D would not function as text input, but rather movement left and right - this guide puts in a measure in the text entry section to disable the movement functionality of A and D during the text input screen, and when you're done, it reverts to normal!

    • Find the line:
      class Window_TextEntry_Keyboard < Window_TextEntry
      Directly under "def update" add the line:
      $game_switches[X] = false
      * Replace "x" with whatever switch you are not using! (make sure its the same variable you use later!)

      Then find the line:
      A few lines below, find the line:
      Now add in this line underneath it:
      $game_switches[X] = true
      *Note, this "x" uses the same variable you used earlier! It has to be the same so it's switching on and off!

    • Use ctrl+shift+f and find:
      def self.buttonToKey(button)
      Change the lines to look like this:
      when Input::DOWN
      	  return [0x28,0x53] # Down, S
      	when Input::LEFT
      	  if !$game_switches || !$game_switches[X]
      		return [0x25] # Left
      		return [0x25,0x41] # Left, A
      	when Input::RIGHT
      	  if !$game_switches || !$game_switches[X]
      		return [0x27] # Right
      		return [0x27,0x44] # Right, D
      	when Input::UP
      	  return [0x26,0x57] # Up, W
      *The X is the exact same variable as in step 1!
      *What I did here was add in functionality to not only use the original arrow keys, but to also include the WASD-keys. However, the functionality ceases whenever you activate the switch, and in the first step we included measures to use the switch to, when you input text with a key-board, remove the A and D function, and when inputting the text ends, it reverts to normal WASD functionality.
    Dawn Bronze likes this.