Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Controlling Character with WASD

Mechz

Member

I'm afraid I don't have a script answer (I would like the defaults to be WASD for my project, too), but you know you can set the controls while playing the game by pressing F1.

Ah shit, nevermind. I guess you can't.
 
*cough, cough*

Code:
class Game_Player  
  #--------------------------------------------------------------------------
  # * Processing of Movement via input from the Directional Buttons
  #--------------------------------------------------------------------------
  def move_by_input
    return unless movable?
    return if $game_map.interpreter.running?
    if Input.press?(Input::X)
      move_left
    elsif Input.press?(Input::Y)
      move_down
    elsif Input.press?(Input::Z)
      move_right
    elsif Input.press?(Input::R)
      move_up
    end
  end
end

Is that what you wanted?
 

drzjj

Member

i want to do this as well but when i entered the script and pressed test play, i get this error message:

Script 'Game_Player' line 339: NameError occurred.

undefined local variable or method `move_by_inut' for
#<Game_Player:0x21d7430>
---------------
I dont know what to do...
Please help :sad:
 
drzjj":mru1489m said:
i want to do this as well but when i entered the script and pressed test play, i get this error message:

Script 'Game_Player' line 339: NameError occurred.

undefined local variable or method `move_by_inut' for
#<Game_Player:0x21d7430>
---------------
I dont know what to do...
Please help :sad:

I'm not positive, but I'm pretty sure that you have to edit a part of the pre-existing default script, as opposed to just adding that.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top