Project1

标题: 怎么把移动换成WASD啊 [打印本页]

作者: 踢腿水上飘    时间: 2025-2-8 11:28
标题: 怎么把移动换成WASD啊
如题如题,我想的是WASD移动,Q确认,E取消,一只手就能玩游戏
作者: 魔法丶小肉包    时间: 2025-2-9 17:51
WASD移动,直接放在main上面即可,没有做过多的测试,不确定会不会在某些情况下出现BUG
RUBY 代码复制
  1. class Game_Player
  2.   def move_by_input
  3.     return if !movable? || $game_map.interpreter.running?
  4.     move_straight(Input.move_sym) if Input.move_sym > 0
  5.   end
  6. end
  7. class << Input
  8.   @@move_sym = 0
  9.   def move_sym
  10.     @@move_sym
  11.   end
  12.   alias mfupdate update
  13.   def update
  14.     mfupdate
  15.     if press?(:R) || press?(:X) || press?(:Y) || press?(:Z)
  16.       @@move_sym = 8 if press?(:R)
  17.       @@move_sym = 4 if press?(:X)
  18.       @@move_sym = 2 if press?(:Y)
  19.       @@move_sym = 6 if press?(:Z)
  20.     else
  21.       @@move_sym = 0
  22.     end
  23.   end
  24. end

作者: 踢腿水上飘    时间: 2025-2-9 21:43
本帖最后由 踢腿水上飘 于 2025-2-9 22:24 编辑
魔法丶小肉包 发表于 2025-2-9 17:51
WASD移动,直接放在main上面即可,没有做过多的测试,不确定会不会在某些情况下出现BUG
class Game_Player
...


额 谢谢了,不过不是这个 ,我表达不清楚,我是想让WASD直接换掉方向键,不只是移动,在菜单,使用道具,整队,战斗等等所有使用方向键的地方全部给换成WASD,想得是WASD移动,ZX确认退出,QE做LR,这样一只手就能玩游戏了
我翻了下脚本 应该是改这里
RUBY 代码复制
  1. def process_cursor_move
  2.     return unless cursor_movable?
  3.     last_index = @index
  4.     cursor_down (Input.trigger?(:DOWN))  if Input.repeat?(:DOWN)
  5.     cursor_up   (Input.trigger?(:UP))    if Input.repeat?(:UP)
  6.     cursor_right(Input.trigger?(:RIGHT)) if Input.repeat?(:RIGHT)
  7.     cursor_left (Input.trigger?(:LEFT))  if Input.repeat?(:LEFT)
  8.     cursor_pagedown   if !handle?(:pagedown) && Input.trigger?(:R)
  9.     cursor_pageup     if !handle?(:pageup)   && Input.trigger?(:L)
  10.     Sound.play_cursor if @index != last_index
  11.   end

但是吧,我试了下:UP 改成:W试了下又不对,不起作用 ,而且F1里也设置不了E键




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1