じ☆ve冰风 发表于 2026-8-5 14:51:36

Michael Super Simple Diagonal Movement Patch

Michael Super Simple Diagonal Movement Patch

Introduction
This is a simple script to enable diagonal movement by default. It's so simple that it's less than 50 lines, I could bleed to metaphorical dead.


How to Use

Put it under material, above main.

if you're using another movement script, put this above that script.

Script

Spoiler                Code:       
#==============================================================================
# Michael Basic 8D
#==============================================================================
class Game_Map
def x_with_direction(x, d)
   x + ((d == 9 || d == 6 || d == 3) ? 1 : ((d == 7 || d == 4 || d == 1) ? -1 : 0))
end
def y_with_direction(y, d)
   y + ((d == 1 || d == 2 || d == 3) ? 1 : ((d == 7 || d == 8 || d == 9) ? -1 : 0))
end
def round_x_with_direction(x, d)
   round_x(x + ((d == 9 || d == 6 || d == 3) ? 1 : ((d == 7 || d == 4 || d == 1) ? -1 : 0)))
end
def round_y_with_direction(y, d)
   round_y(y + ((d == 1 || d == 2 || d == 3) ? 1 : ((d == 7 || d == 8 || d == 9) ? -1 : 0)))
end
end
class Game_Character < Game_CharacterBase
def turn_right_90
   case @direction
   when 1; set_direction(7); when 2; set_direction(4)
   when 3; set_direction(1); when 4; set_direction(8)
   when 6; set_direction(2); when 7; set_direction(9)
   when 8; set_direction(6); when 9; set_direction(3)
   end
end
def turn_left_90
   case @direction
   when 1; set_direction(3); when 2; set_direction(6)
   when 3; set_direction(9); when 4; set_direction(2)
   when 6; set_direction(8); when 7; set_direction(1)
   when 8; set_direction(4); when 9; set_direction(7)
   end
end
end
class Game_Player < Game_Character
def move_by_input
   return if !movable? || $game_map.interpreter.running?
   case Input.dir8
   when 2,4,6,8; move_straight(Input.dir8)
   when 1; move_diagonal(4, 2); when 3; move_diagonal(6, 2)
   when 7; move_diagonal(4, 8); when 9; move_diagonal(6, 8)
   else; end
end
end





Terms

Feel free to change, edit, use like as a slave, burn maybe.

Credit is also optional

edit: text format is updated to display the script


本贴来自国际rpgmaker官方论坛作者:Mike处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/michael-super-simple-diagonal-movement-patch.23562/
页: [1]
查看完整版本: Michael Super Simple Diagonal Movement Patch