搜索附件  
同能RPG制作大师 附件中心 同能RM技术讨论区 RPG Maker XP 讨论区 【原创】事件寻路脚本(基于广度优先搜索和RGSS1): d1.png

【原创】事件寻路脚本(基于广度优先搜索和RGSS1): d1.png

 

【原创】事件寻路脚本(基于广度优先搜索和RGSS1):
旧版本


以下为最新版本
用法:在事件页中使用脚本,输入以下内容。
RUBY 代码
  1. BFS.find_path(character, target_x, target_y)
复制代码

说明:
如果想要移动主角,character为$game_player;若想移动事件,character为$game_map.events[n] (注:n为相应事件的ID)
注意:该脚本适用于较小的地图(推荐不超过100*100)且工程的系统应基于默认的RGSS。
RUBY 代码下载

[code]module BFS
  defself.find_path(character, tx, ty)
    ox, oy = character.x, character.y
    returnif(tx > $game_map.width - 1) || (ty > $game_map.height - 1)
    returnif !($game_map.passable?(tx, ty, 0, character))
    returnif(tx == ox) && (ty == oy)
    checked = []
    father = []
    for i in0...$game_map.width
      checked
【原创】事件寻路脚本(基于广度优先搜索和RGSS1): d1.png

QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

GMT+8, 2024-9-21 12:29 , Processed in 0.037673 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

返回顶部