主要功能
1,智能寻路,按住 D 键可以扩大寻路的范围
2,变量输入框改良
3,鼠标启动事件:
在事件中加入“注释”:鼠标启动
该事件将无法用其它方式启动,只能用鼠标左键点击启动
鼠标指针图片 MouseCursor.png 放入 Graphics\System 文件夹
路径点指示图片 $Arrow.png 放入 Graphics\Characters 文件夹
如果未放入会使用RM自带图片代替缺失文件
------- 下载 -------
鼠标2.32 + 指针变换脚本.rar (340.04 KB, 下载次数: 3977) 附件未包含 RGSS300.dll 运行前 Ctrl + S 保存即可。
https://rpg.blue/thread-347535-1-1.html 提供了 dll 支持的鼠标脚本 v3.00,支持鼠标滚轮功能。
------ 额外功能 ------
.rb 文件可以直接用记事本打开。
鼠标选择敌人v1.3.rb (4.27 KB, 下载次数: 1290)
鼠标选择敌人 v1.3 兼容后知后觉横版战斗.rb (4.33 KB, 下载次数: 952) 如果你没有使用这个横版战斗,请下载上面的脚本
八方移动补丁v1.3.rb (18.09 KB, 下载次数: 724)
需要使用八方行走图的话这里有:脚本链接
路径可视化补丁v1.1.rar (5.76 KB, 下载次数: 1176)
感觉蛮鸡肋,需要的话就带走吧。
#============================================================================== # ■ VXAce-RGSS3-18 ギャラリー by Claimh #------------------------------------------------------------------------------ # 写真を表示するギャラリーを作ります # なお、ギャラリーの管理情報は全セーブデータで共通となります。 #------------------------------------------------------------------------------ # ●ギャラリー全体の表示許可 # DataManager.garally.enable = true # ●写真の表示許可 # DataManager.garally[id] = true # ●写真の追加(LIST以外のスナップショットなどを追加) # DataManager.garally.push(id, GFile.new(filename, text)) # ●イベント等から呼び出す # SceneManager.call(Scene_ExGarally) #============================================================================== class GFile attr_reader :name attr_reader :text def initialize(filename, text="") @name = filename; @text = text end end module ExGarally # 写真の設定 LIST = { # ID => GFile.new("ファイル名(Graphics/Pictures)", 表示文字) 1 => GFile.new("BlueSky", "青い空\n改行"), 2 => GFile.new("CloudySky1", "曇った空"), 3 => GFile.new("CloudySky2"), 4 => GFile.new("DarkSpace1"), 5 => GFile.new("DarkSpace2"), 6 => GFile.new("Mountains1"), 7 => GFile.new("Mountains2"), 8 => GFile.new("Mountains3"), 9 => GFile.new("Mountains4"), 10 => GFile.new("Mountains5"), 12 => GFile.new("Ocean2"), 11 => GFile.new("Ocean1"), 13 => GFile.new("SeaofClouds"), 14 => GFile.new("StarlitSky"), # 15 => GFile.new("Sunset"), } # ヘルプウィンドウの行数(1~3) HELP_LINES = 2 end #============================================================================== # ■ ExGarally #============================================================================== module ExGarally #-------------------------------------------------------------------------- # ● ギャラリーの表示有効? #-------------------------------------------------------------------------- def self.enable? DataManager.garally.enable end #-------------------------------------------------------------------------- # ● ファイル名 #-------------------------------------------------------------------------- def self.filename "exgallary.rvdata2" end #-------------------------------------------------------------------------- # ● セーブの実行 #-------------------------------------------------------------------------- def self.save_exdata(obj) save_data(obj, filename) end #-------------------------------------------------------------------------- # ● ロードの実行 #-------------------------------------------------------------------------- def self.load_exdata exist? ? load_data(filename) : Game_ExGarallyList.new end #-------------------------------------------------------------------------- # ● ファイル削除 #-------------------------------------------------------------------------- def self.delete_exdata return unless exist? File.delete(filename) rescue nil end #-------------------------------------------------------------------------- # ● ファイルの有無チェック #-------------------------------------------------------------------------- def self.exist? FileTest.exist?(filename) end end #============================================================================== # ■ DataManager #============================================================================== class << DataManager #-------------------------------------------------------------------------- # ● 各種ゲームオブジェクトの作成 #-------------------------------------------------------------------------- alias create_game_objects_exgrly create_game_objects def create_game_objects create_game_objects_exgrly load_garally end #-------------------------------------------------------------------------- # ● セーブの実行 #-------------------------------------------------------------------------- alias save_game_exgarally save_game def save_game(index) r = save_game_exgarally(index) save_garally if r r end #-------------------------------------------------------------------------- # ● ロードの実行 #-------------------------------------------------------------------------- alias load_game_exgrly load_game def load_game(index) r = load_game_exgrly(index) load_garally if r r end #-------------------------------------------------------------------------- # ● ギャラリー情報load #-------------------------------------------------------------------------- def load_garally @exgarally = ExGarally.load_exdata end #-------------------------------------------------------------------------- # ● ギャラリー情報load #-------------------------------------------------------------------------- def save_garally ExGarally.save_exdata(@exgarally) end #-------------------------------------------------------------------------- # ● ギャラリー情報削除 #-------------------------------------------------------------------------- def delete_garally ExGarally.delete_exdata load_garally end #-------------------------------------------------------------------------- # ● ギャラリー情報参照 #-------------------------------------------------------------------------- def garally @exgarally end end #============================================================================== # ■ Game_ExGarally #============================================================================== class Game_ExGarally attr_accessor :name # ファイル名 attr_accessor :text # 表示文字 attr_accessor :enable # 表示可否 #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(file, enable=false) @name = file.name @text = file.text @enable = enable end end #============================================================================== # ■ Game_ExGarallyList : DataManager.garallyで参照可能 #============================================================================== class Game_ExGarallyList LIST = ExGarally::LIST attr_accessor :enable attr_reader :size #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize clear end #-------------------------------------------------------------------------- # ● クリア #-------------------------------------------------------------------------- def clear @size = LIST.size @data = {} @enable = false end #-------------------------------------------------------------------------- # ● 参照 #-------------------------------------------------------------------------- def [](id) return nil if LIST[id].nil? and @data[id].nil? return Game_ExGarally.new(LIST[id]) if @data[id].nil? @data[id] end #-------------------------------------------------------------------------- # ● 表示許可/禁止 #-------------------------------------------------------------------------- def []=(id, val) return nil if LIST[id].nil? and @data[id].nil? if val @data[id] = Game_ExGarally.new(LIST[id]) if @data[id].nil? @data[id].enable = true elsif !@data[id].nil? @data.delete(id) end end #-------------------------------------------------------------------------- # ● リスト #-------------------------------------------------------------------------- def list (@data.keys+LIST.keys).uniq.sort.collect {|id| self.[](id) } end #-------------------------------------------------------------------------- # ● 追加ギャラリー #-------------------------------------------------------------------------- def push(id, name, enable=true) @data[id] = Game_ExGarally.new(name, enable) @size += 1 if LIST[id].nil? end end #============================================================================== # ■ Sprite_ExGrlyPicture #============================================================================== class Sprite_ExGrlyPicture < Sprite #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(rect=Rect.new(0,0,Graphics.width,Graphics.height)) super(Viewport.new(rect)) viewport.z = 100 create_bitmap end #-------------------------------------------------------------------------- # ● オブジェクト解放 #-------------------------------------------------------------------------- def dispose dispose_bitmap super end #-------------------------------------------------------------------------- # ● ビットマップ生成 #-------------------------------------------------------------------------- def create_bitmap self.bitmap = Bitmap.new(vw, vh) end #-------------------------------------------------------------------------- # ● ビットマップ下方 #-------------------------------------------------------------------------- def dispose_bitmap self.bitmap.dispose end #-------------------------------------------------------------------------- # ● ピクチャ設定 #-------------------------------------------------------------------------- def picture(filename, enabled=true) dispose_bitmap if enabled self.bitmap = Cache.picture(filename) else create_bitmap self.bitmap.fill_rect(0,0,vw,vh,Color.new(0,0,0,160)) # self.bitmap.draw_text(0,0, vw, vh, filename, 1) end fit_screen resize end #-------------------------------------------------------------------------- # ● ズーム倍率再設定 #-------------------------------------------------------------------------- def resize(r=Rect.new(0,0,vw,vh)) self.ox = bitmap.width / 2 self.oy = bitmap.height / 2 self.x = r.width / 2 + r.x self.y = r.height / 2 + r.y end #-------------------------------------------------------------------------- # ● 画面にフィットさせる #-------------------------------------------------------------------------- def bwz; (bitmap.width * zoom_x).truncate; end # ズーム後のbitmap幅 def bhz; (bitmap.height* zoom_y).truncate; end # ズーム後のbitmap高さ def vw; viewport.rect.width; end def vh; viewport.rect.height; end def fit_screen(w=vw, h=vh) x_zoom = w * 1.0 / bitmap.width y_zoom = h * 1.0 / bitmap.height zoom = x_zoom < y_zoom ? x_zoom : y_zoom self.zoom_x = self.zoom_y = zoom end end #============================================================================== # ■ Sprite_ExGrlyPicture #============================================================================== class Sprite_ExGrlyPictFull < Sprite_ExGrlyPicture #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super hide.viewport.z = 200 end #-------------------------------------------------------------------------- # ● ウィンドウの表示 #-------------------------------------------------------------------------- def show self.visible = true self end #-------------------------------------------------------------------------- # ● ウィンドウの非表示 #-------------------------------------------------------------------------- def hide self.visible = false self end #-------------------------------------------------------------------------- # ● ピクチャ設定 #-------------------------------------------------------------------------- def picture(filename, enabled=true) dispose_bitmap b = Cache.picture(filename) r = Rect.new(0, 0, b.width, b.height) self.bitmap = Bitmap.new(r.width, r.height) self.bitmap.stretch_blt(r, b, r) fit_screen resize end end #============================================================================== # ■ Grly_Thumbnail #============================================================================== class Grly_Thumbnail attr_reader :item attr_reader :rect #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(item, rect) @item = item; @rect = rect end end #============================================================================== # ■ SpritesetExGrlyPictures #============================================================================== class SpritesetExGrlyPictures #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @sprites = [] end #-------------------------------------------------------------------------- # ● オブジェクト解放 #-------------------------------------------------------------------------- def dispose dispose_sprites end #-------------------------------------------------------------------------- # ● ピクチャスプライト生成 #-------------------------------------------------------------------------- def create_sprites(thumnails) thumnails.each do |thm| s = Sprite_ExGrlyPicture.new(thm.rect) s.picture(thm.item.name, thm.item.enable) @sprites.push(s) end end #-------------------------------------------------------------------------- # ● ピクチャスプライト解放 #-------------------------------------------------------------------------- def dispose_sprites @sprites.each { |s| s.dispose } end #-------------------------------------------------------------------------- # ● ピクチャスプライト更新 #-------------------------------------------------------------------------- def update_sprites(thumnails) dispose_sprites create_sprites(thumnails) end #-------------------------------------------------------------------------- # ● サムネイル矩形 #-------------------------------------------------------------------------- def thm_rect(i) @sprites[i].nil? ? nil : @sprites[i].thm end end #============================================================================== # ■ Window_GrlyPicture #============================================================================== class Window_GrlyPicture < Window_Selectable attr_accessor :thum_sprites #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize @thum_sprites = nil make_list super(0, help_height, Graphics.width, Graphics.height-help_height) activate end #-------------------------------------------------------------------------- # ● ヘルプウィンドウの高さ #-------------------------------------------------------------------------- def help_height fitting_height(ExGarally::HELP_LINES) end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max return 3 end #-------------------------------------------------------------------------- # ● 横に項目が並ぶときの空白の幅を取得 #-------------------------------------------------------------------------- def spacing return 16 end #-------------------------------------------------------------------------- # ● 項目数の取得 #-------------------------------------------------------------------------- def item_max DataManager.garally.size end #-------------------------------------------------------------------------- # ● 項目の高さを取得 #-------------------------------------------------------------------------- def item_height (Graphics.height - help_height - standard_padding * 2) / 2 end #-------------------------------------------------------------------------- # ● 項目を描画する矩形の取得 #-------------------------------------------------------------------------- def item_rect(index) rect = super(index) thm = calc_thm_rect rect.x += (rect.width - (thm.width + 8)) / 2 rect.y += (rect.height - (thm.height + 8)) / 2 rect.width = thm.width + 8 rect.height = thm.height + 8 rect end #-------------------------------------------------------------------------- # ● サムネイル矩形計算 #-------------------------------------------------------------------------- def calc_thm_rect r = Rect.new r.width = item_width - 8 r.height = item_height - 8 if (Graphics.width / r.width) > (Graphics.height / r.height) r.height = r.width * Graphics.height / Graphics.width else r.width = r.height * Graphics.width / Graphics.height end r end #-------------------------------------------------------------------------- # ● サムネイルの表示位置を取得 #-------------------------------------------------------------------------- def thum_rect(index) r = item_rect_for_text(index) r.x += self.x + standard_padding r.y += self.y + standard_padding r end #-------------------------------------------------------------------------- # ● 先頭行のindex #-------------------------------------------------------------------------- def top_i (top_row * col_max) end #-------------------------------------------------------------------------- # ● 先頭行からの@index #-------------------------------------------------------------------------- def top_cur_i (@index - (top_row * col_max)) end #-------------------------------------------------------------------------- # ● サムネイルの表示位置を取得 #-------------------------------------------------------------------------- def thumnails n = [page_item_max, item_max - top_i].min idxs = [] n.times { |i| idxs.push(i) } idxs.collect { |i| Grly_Thumbnail.new(@list[i+top_i], thum_rect(i)) } end #-------------------------------------------------------------------------- # ● リスト生成 #-------------------------------------------------------------------------- def make_list @list = DataManager.garally.list end #-------------------------------------------------------------------------- # ● 選択中アイテム #-------------------------------------------------------------------------- def item @list[@index] end #-------------------------------------------------------------------------- # ● 選択項目の有効状態を取得 #-------------------------------------------------------------------------- def current_item_enabled? !item.nil? and item.enable end #-------------------------------------------------------------------------- # ● ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help text = ((!item.nil? and item.enable) ? item.text : "") @help_window.set_text(text) end #-------------------------------------------------------------------------- # ● カーソルの更新 #-------------------------------------------------------------------------- def update_cursor super @thum_sprites.update_sprites(thumnails) unless @thum_sprites.nil? end end #============================================================================== # ■ Scene_ExGarally #============================================================================== class Scene_ExGarally < Scene_Base #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_background @help_window = Window_Help.new(ExGarally::HELP_LINES) @thumset = SpritesetExGrlyPictures.new @full_pict = Sprite_ExGrlyPictFull.new create_list_window end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- def terminate super dispose_background @thumset.dispose @full_pict.dispose end #-------------------------------------------------------------------------- # ● 背景の作成 #-------------------------------------------------------------------------- def create_background @background_sprite = Sprite.new @background_sprite.bitmap = SceneManager.background_bitmap @background_sprite.color.set(16, 16, 16, 128) end #-------------------------------------------------------------------------- # ● 背景の解放 #-------------------------------------------------------------------------- def dispose_background @background_sprite.dispose end #-------------------------------------------------------------------------- # ● ピクチャリストウィンドウ生成 #-------------------------------------------------------------------------- def create_list_window @list_window = Window_GrlyPicture.new @list_window.thum_sprites = @thumset @list_window.help_window = @help_window set_full_handler @list_window.select(0) end #-------------------------------------------------------------------------- # ● フルスクリーン化用のハンドラ登録 #-------------------------------------------------------------------------- def set_full_handler @list_window.set_handler(:ok, method(:cmd_full)) @list_window.set_handler(:cancel, method(:return_scene)) end #-------------------------------------------------------------------------- # ● サムネイルリスト用のハンドラ登録 #-------------------------------------------------------------------------- def set_thum_handler @list_window.set_handler(:ok, method(:cmd_thum)) @list_window.set_handler(:cancel, method(:cmd_thum)) end #-------------------------------------------------------------------------- # ● フルスクリーン化 #-------------------------------------------------------------------------- def cmd_full Graphics.freeze @full_pict.show.picture(@list_window.item.name) perform_transition set_thum_handler @list_window.activate.cursor_fix = true end #-------------------------------------------------------------------------- # ● サムネイル化 #-------------------------------------------------------------------------- def cmd_thum Graphics.freeze @full_pict.hide perform_transition set_full_handler @list_window.activate.cursor_fix = false end end #module Title # 拡張コマンドへ追加 #EXCMD[3] = ["画廊", Scene_ExGarally, :garally] # コマンド画像ファイル(Graphics/System) # CMD_GRPHIC[コマンド番号] [画像1, 画像2] #CMD_GRPHIC[3] = ["garally", "garally_s"] #end #============================================================================== # ■ Scene_ExGarally #============================================================================== class Scene_ExGarally < Scene_Base #-------------------------------------------------------------------------- # ● 呼び出し元のシーンへ戻る #-------------------------------------------------------------------------- def return_scene super return unless SceneManager.scene_is?(Scene_Title) SceneManager.scene.prepare(Title::Scene::S_TITLE, false, Title::CMD_BOX.index(4)) end end #============================================================================== # ■ Scene_Title #============================================================================== class Scene_Title < Scene_Base #-------------------------------------------------------------------------- # ● メイン #-------------------------------------------------------------------------- alias main_reload main def main DataManager.load_garally # ギャラリーのリロード main_reload end end
=begin ======================================================================== 八方移动补丁 置于Sion_Mouse_System脚本下 2013.10.28 v1.2 鼠标2.0+更新修正 2013.5.3 v1.1 修正斜向触发事件 =end #========================================================================= class Game_Player # ─────────────────────────────────────── # † 八方移动 # ─────────────────────────────────────── 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 if diagonal_passable?(x, y, 4, 2); move_diagonal(4, 2) elsif passable?(x, y, 4); move_straight(4) else; move_straight(2) end when 3 if diagonal_passable?(x, y, 6, 2); move_diagonal(6, 2) elsif passable?(x, y, 6); move_straight(6) else; move_straight(2) end when 7 if diagonal_passable?(x, y, 4, 8); move_diagonal(4, 8) elsif passable?(x, y, 4); move_straight(4) else; move_straight(8) end when 9 if diagonal_passable?(x, y, 6, 8); move_diagonal(6, 8) elsif passable?(x, y, 6); move_straight(6) else; move_straight(6) end else; move_by_mouse end end # ─────────────────────────────────────── # † 鼠标八方移动 # ─────────────────────────────────────── def move_by_mouse unless @mouse_move_path.empty? # 移动路线数组不为空则执行移动 dir = @mouse_move_path.shift if passable?(x, y, dir) && !@mouse_move_path.empty? if @mouse_move_path[0] == dir move_straight(dir) else if @mouse_move_path.size == 1 && touch_event?(x, y, dir, @mouse_move_path[0]) move_straight(dir) elsif dir == 4 || dir == 6 move_diagonal(dir, @mouse_move_path.shift) else move_diagonal(@mouse_move_path.shift, dir) end end elsif @mouse_move_path.empty? # 判断是否是最后一步 x2 = $game_map.round_x_with_direction(x, dir) y2 = $game_map.round_y_with_direction(y, dir) move_straight(dir) unless dir.zero? unless x == x2 && y == y2 # 如果移动失败,检查是否启动前方事件、上下载具 check_event_trigger_there([0,1,2]) get_on_off_vehicle unless $game_map.setup_starting_event end $mouse_move_sign.transparent = true if $mouse_move_sign.direction == 2 @mouse_dash = false elsif @mouse_move_path[0].zero? # 目标点无法抵达,调整朝向→目标点 @mouse_move_path.shift @direction = dir @mouse_dash = false else draw_move_path end end end def touch_event?(x, y, dir, dir_) x = $game_map.round_x_with_direction( $game_map.round_x_with_direction(x, dir), dir_) y = $game_map.round_y_with_direction( $game_map.round_y_with_direction(y, dir), dir_) if collide_with_events?(x, y) return x, y else return nil, nil end end # ─────────────────────────────────────── # † 步行路径 # ─────────────────────────────────────── def draw_walk_path # 准备绘制路径表格 sheet = Table.new($game_map.width, $game_map.height) chase_path = [] new_end_points = [@moveto_x, @moveto_y] sheet[@moveto_x, @moveto_y] = 1 reach_point = false step = 2 loop do #loop1 开始填充表格 draw_path = false check_points = new_end_points new_end_points = [] break if step > KsOfSion::Break_Steps && !Input.press?(KsOfSion::Find_Path_Key) loop do #loop3 从终点开始反向填充 point_x = check_points.shift break if point_x == nil point_y = check_points.shift # 判断路径是否连通 if point_x == x && point_y == y reach_point = true; break; end # 以需要抵达该点的步数填充路径表格 # left_x = $game_map.round_x(point_x - 1) right_x = $game_map.round_x(point_x + 1) up_y = $game_map.round_y(point_y - 1) down_y = $game_map.round_y(point_y + 1) if sheet[left_x, point_y] == 0 && $game_map.passable?(left_x, point_y, 6) && !collide_with_events?(left_x, point_y) && $game_map.passable?(point_x, point_y, 4) && !collide_with_vehicles?(left_x, point_y) #judge_end sheet[left_x, point_y] = step draw_path = true new_end_points.push(left_x, point_y) end if sheet[right_x, point_y] == 0 && $game_map.passable?(right_x, point_y, 4) && !collide_with_events?(right_x, point_y) && $game_map.passable?(point_x, point_y, 6) && !collide_with_vehicles?(right_x, point_y)#judge_end sheet[right_x, point_y] = step draw_path = true new_end_points.push(right_x, point_y) end if sheet[point_x, up_y] == 0 && $game_map.passable?(point_x, up_y, 2) && !collide_with_events?(point_x, up_y) && $game_map.passable?(point_x, point_y, 8) && !collide_with_vehicles?(point_x, up_y) #judge_end sheet[point_x, up_y] = step draw_path = true new_end_points.push(point_x, up_y) end if sheet[point_x, down_y] == 0 && $game_map.passable?(point_x, down_y, 8) && !collide_with_events?(point_x, down_y) && $game_map.passable?(point_x, point_y, 2) && !collide_with_vehicles?(point_x, down_y) #judge_end sheet[point_x, down_y] = step draw_path = true new_end_points.push(point_x, down_y) end end#endOfLoop3 break if !draw_path || reach_point step += 1 end #endOfLoop1 路径表格填充完毕 $mouse_move_sign.transparent = false # 判断指定地点能否抵达 if reach_point $mouse_move_sign.direction = 2 else return not_reach_point end # 根据路径表格绘制最短移动路径(正向) step -= 1 # 因为需要再填充一次才能判定是否抵达 point_x, point_y = x, y for i in 2..step step -= 1 if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs if sheet[point_x, $game_map.round_y(point_y + 1)] == step && $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) && $game_map.passable?(point_x, point_y, 2) #judge_end chase_path.push(2) point_y = $game_map.round_y(point_y + 1) elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step && $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) && $game_map.passable?(point_x, point_y, 8) #judge_end chase_path.push(8) point_y = $game_map.round_y(point_y - 1) elsif sheet[$game_map.round_x(point_x - 1), point_y] == step && $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) && $game_map.passable?(point_x, point_y, 4) #judge_end chase_path.push(4) point_x = $game_map.round_x(point_x - 1) elsif sheet[$game_map.round_x(point_x + 1), point_y] == step && $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) && $game_map.passable?(point_x, point_y, 6) #judge_end chase_path.push(6) point_x = $game_map.round_x(point_x + 1) end else if sheet[$game_map.round_x(point_x - 1), point_y] == step && $game_map.passable?($game_map.round_x(point_x - 1), point_y, 6) && $game_map.passable?(point_x, point_y, 4) #judge_end chase_path.push(4) point_x = $game_map.round_x(point_x - 1) elsif sheet[$game_map.round_x(point_x + 1), point_y] == step && $game_map.passable?($game_map.round_x(point_x + 1), point_y, 4) && $game_map.passable?(point_x, point_y, 6) #judge_end chase_path.push(6) point_x = $game_map.round_x(point_x + 1) elsif sheet[point_x, $game_map.round_y(point_y + 1)] == step && $game_map.passable?(point_x, $game_map.round_y(point_y + 1), 8) && $game_map.passable?(point_x, point_y, 2) #judge_end chase_path.push(2) point_y = $game_map.round_y(point_y + 1) elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step && $game_map.passable?(point_x, $game_map.round_y(point_y - 1), 2) && $game_map.passable?(point_x, point_y, 8) #judge_end chase_path.push(8) point_y = $game_map.round_y(point_y - 1) end end end#endOfForLoop return chase_path end#walk # ─────────────────────────────────────── # † boat路径 # ─────────────────────────────────────── def draw_boat_path # 准备绘制路径表格 sheet = Table.new($game_map.width, $game_map.height) chase_path = [] new_end_points = [@moveto_x, @moveto_y] sheet[@moveto_x, @moveto_y] = 1 reach_point = false step = 2 loop do #loop1 开始填充表格 draw_path = false check_points = new_end_points new_end_points = [] break if step > KsOfSion::Break_Steps && !Input.press?(KsOfSion::Find_Path_Key) loop do #loop3 从终点开始反向填充 point_x = check_points.shift break if point_x == nil point_y = check_points.shift left_x = $game_map.round_x(point_x - 1) right_x = $game_map.round_x(point_x + 1) up_y = $game_map.round_y(point_y - 1) down_y = $game_map.round_y(point_y + 1) # 判断路径是否连通 if left_x == x && point_y == y reach_point = true; break elsif right_x == x && point_y == y reach_point = true; break elsif point_x == x && up_y == y reach_point = true; break elsif point_x == x && down_y == y reach_point = true; break end # 以需要抵达该点的步数填充路径表格 # if sheet[left_x, point_y] == 0 && $game_map.boat_passable?(left_x, point_y) && !collide_with_events?(left_x, point_y) && !collide_with_vehicles?(left_x, point_y) #judge_end sheet[left_x, point_y] = step draw_path = true new_end_points.push(left_x, point_y) end if sheet[right_x, point_y] == 0 && $game_map.boat_passable?(right_x, point_y) && !collide_with_events?(right_x, point_y) && !collide_with_vehicles?(right_x, point_y) #judge_end sheet[right_x, point_y] = step draw_path = true new_end_points.push(right_x, point_y) end if sheet[point_x, up_y] == 0 && $game_map.boat_passable?(point_x, up_y) && !collide_with_events?(point_x, up_y) && !collide_with_vehicles?(point_x, up_y) #judge_end sheet[point_x, up_y] = step draw_path = true new_end_points.push(point_x, up_y) end if sheet[point_x, down_y] == 0 && $game_map.boat_passable?(point_x, down_y) && !collide_with_events?(point_x, down_y) && !collide_with_vehicles?(point_x, down_y) #judge_end sheet[point_x, down_y] = step draw_path = true new_end_points.push(point_x, down_y) end end#endOfLoop3 break if !draw_path || reach_point step += 1 end #endOfLoop1 路径表格填充完毕 $mouse_move_sign.transparent = false # 判断指定地点能否抵达 if reach_point $mouse_move_sign.direction = 2 else return not_reach_point end # 根据路径表格绘制最短移动路径(正向) point_x, point_y = x, y for i in 2..step # forLoop step -= 1 if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs if sheet[point_x, $game_map.round_y(point_y + 1)] == step chase_path.push(2) point_y = $game_map.round_y(point_y + 1) elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step chase_path.push(8) point_y = $game_map.round_y(point_y - 1) elsif sheet[$game_map.round_x(point_x - 1), point_y] == step chase_path.push(4) point_x = $game_map.round_x(point_x - 1) elsif sheet[$game_map.round_x(point_x + 1), point_y] == step chase_path.push(6) point_x = $game_map.round_x(point_x + 1) end else if sheet[$game_map.round_x(point_x - 1), point_y] == step chase_path.push(4) point_x = $game_map.round_x(point_x - 1) elsif sheet[$game_map.round_x(point_x + 1), point_y] == step chase_path.push(6) point_x = $game_map.round_x(point_x + 1) elsif sheet[point_x, $game_map.round_y(point_y + 1)] == step chase_path.push(2) point_y = $game_map.round_y(point_y + 1) elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step chase_path.push(8) point_y = $game_map.round_y(point_y - 1) end end end #endOfForLoop # 如果指定点无法抵达或者登陆 return not_reach_point unless landable?(@moveto_x, @moveto_y, chase_path) return chase_path end#boat # ─────────────────────────────────────── # † ship路径 # ─────────────────────────────────────── def draw_ship_path # 准备绘制路径表格 sheet = Table.new($game_map.width, $game_map.height) chase_path = [] new_end_points = [@moveto_x, @moveto_y] sheet[@moveto_x, @moveto_y] = 1 reach_point = false step = 2 loop do #loop1 开始填充表格 draw_path = false check_points = new_end_points new_end_points = [] break if step > KsOfSion::Break_Steps && !Input.press?(KsOfSion::Find_Path_Key) loop do #loop3 从终点开始反向填充 point_x = check_points.shift break if point_x == nil point_y = check_points.shift left_x = $game_map.round_x(point_x - 1) right_x = $game_map.round_x(point_x + 1) up_y = $game_map.round_y(point_y - 1) down_y = $game_map.round_y(point_y + 1) # 判断路径是否连通 if left_x == x && point_y == y reach_point = true; break elsif right_x == x && point_y == y reach_point = true; break elsif point_x == x && up_y == y reach_point = true; break elsif point_x == x && down_y == y reach_point = true; break end # 以需要抵达该点的步数填充路径表格 # if sheet[left_x, point_y] == 0 && $game_map.ship_passable?(left_x, point_y) && !collide_with_events?(left_x, point_y) && !collide_with_vehicles?(left_x, point_y) #judge_end sheet[left_x, point_y] = step draw_path = true new_end_points.push(left_x, point_y) end if sheet[right_x, point_y] == 0 && $game_map.ship_passable?(right_x, point_y) && !collide_with_events?(right_x, point_y) && !collide_with_vehicles?(right_x, point_y) #judge_end sheet[right_x, point_y] = step draw_path = true new_end_points.push(right_x, point_y) end if sheet[point_x, up_y] == 0 && $game_map.ship_passable?(point_x, up_y) && !collide_with_events?(point_x, up_y) && !collide_with_vehicles?(point_x, up_y) #judge_end sheet[point_x, up_y] = step draw_path = true new_end_points.push(point_x, up_y) end if sheet[point_x, down_y] == 0 && $game_map.ship_passable?(point_x, down_y) && !collide_with_events?(point_x, down_y) && !collide_with_vehicles?(point_x, down_y) #judge_end sheet[point_x, down_y] = step draw_path = true new_end_points.push(point_x, down_y) end end#endOfLoop3 break if !draw_path || reach_point step += 1 end #endOfLoop1 路径表格填充完毕 $mouse_move_sign.transparent = false # 判断指定地点能否抵达 if reach_point $mouse_move_sign.direction = 2 else not_reach_point return end # 根据路径表格绘制最短移动路径(正向) point_x, point_y = x, y for i in 2..step step -= 1 if (@moveto_x - point_x).abs < (@moveto_y - point_y).abs if sheet[point_x, $game_map.round_y(point_y + 1)] == step chase_path.push(2) point_y = $game_map.round_y(point_y + 1) elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step chase_path.push(8) point_y = $game_map.round_y(point_y - 1) elsif sheet[$game_map.round_x(point_x - 1), point_y] == step chase_path.push(4) point_x = $game_map.round_x(point_x - 1) elsif sheet[$game_map.round_x(point_x + 1), point_y] == step chase_path.push(6) point_x = $game_map.round_x(point_x + 1) end else if sheet[$game_map.round_x(point_x - 1), point_y] == step chase_path.push(4) point_x = $game_map.round_x(point_x - 1) elsif sheet[$game_map.round_x(point_x + 1), point_y] == step chase_path.push(6) point_x = $game_map.round_x(point_x + 1) elsif sheet[point_x, $game_map.round_y(point_y + 1)] == step chase_path.push(2) point_y = $game_map.round_y(point_y + 1) elsif sheet[point_x, $game_map.round_y(point_y - 1)] == step chase_path.push(8) point_y = $game_map.round_y(point_y - 1) end end end #endOfForLoop # 如果指定点无法抵达或者登陆 return not_reach_point unless landable?(@moveto_x, @moveto_y, chase_path) return chase_path end#ship end
#=============================================================================== # 八方向行走 # by:铅笔描绘的思念 # 在Characters里添加八方向行走图(命名规范:在四方向上的基础上+_8D) # 行走动画就为8方向的。否则就会原4方向的代替8方向的。 # # 八方向:数字键盘方向对应的数字 # 7 8 9 # ↖ ↑ ↗ # 4← 0 →6 # ↙ ↓ ↘ # 1 2 3 #=============================================================================== #============================================================================== # ■ Game_Player #============================================================================== class Game_Player < Game_Character #-------------------------------------------------------------------------- # ● 八方向移动 # d :1、3、7、9 对应小键盘的四个方向 #-------------------------------------------------------------------------- def move_eight_dir(d) move_diagonal(d + 3,2) if d == 1 || d == 3 move_diagonal(d - 3,8) if d == 7 || d == 9 end #-------------------------------------------------------------------------- # ● 八方向按键 #-------------------------------------------------------------------------- def move_by_input return if !movable? || $game_map.interpreter.running? case Input.dir8 when 1,3,7,9; move_eight_dir(Input.dir8) when 2,4,6,8; move_straight(Input.dir4) end end #-------------------------------------------------------------------------- # ● 斜向移动 # horz : 横向(4 or 6) # vert : 纵向(2 or 8) #-------------------------------------------------------------------------- def move_diagonal(horz, vert) @followers.move if diagonal_passable?(@x, @y, horz, vert) @move_succeed = diagonal_passable?(x, y, horz, vert) last_steps = $game_party.steps if @move_succeed @x = $game_map.round_x_with_direction(@x, horz) @y = $game_map.round_y_with_direction(@y, vert) @real_x = $game_map.x_with_direction(@x, reverse_dir(horz)) @real_y = $game_map.y_with_direction(@y, reverse_dir(vert)) increase_steps # 八方向移动正确步数计算 if $game_party.steps - last_steps == 2 $game_party.decrease_steps end end set_direction(2) if horz == 4 && vert == 2 set_direction(4) if horz == 4 && vert == 8 set_direction(6) if horz == 6 && vert == 2 set_direction(8) if horz == 6 && vert == 8 end end #============================================================================== # ■ Game_Party #============================================================================== class Game_Party < Game_Unit def decrease_steps @steps -= 1 end end #============================================================================== # ■ Sprite_Character #============================================================================== class Sprite_Character < Sprite_Base #-------------------------------------------------------------------------- # ● 更新源位图(Source Bitmap) #-------------------------------------------------------------------------- alias update_bitmap_8dir update_bitmap def update_bitmap update_bitmap_8dir if @tile_id > 0 @enable_slant = false return end unless graphic_changed? @enable_slant = true end begin @character_name_slant = "#{@character_name}_8D" Cache.character(@character_name_slant) rescue @enable_slant = false end end #-------------------------------------------------------------------------- # ● 更新源矩形 #-------------------------------------------------------------------------- alias update_src_rect_8dir update_src_rect def update_src_rect return if @tile_id > 0 if @enable_slant && @character != $game_map.events update_src_rect_for_slant else update_src_rect_8dir end end #-------------------------------------------------------------------------- # ● 更新斜方向传送矩形 #-------------------------------------------------------------------------- def update_src_rect_for_slant index = @character.character_index pattern = @character.pattern < 3 ? @character.pattern : 1 sx = (index % 4 * 3 + pattern) * @cw case Input.dir8 % 2 when 0 # 上下左右 if @last_slant self.bitmap = Cache.character(@character_name) @last_slant = false end else unless @last_slant self.bitmap = Cache.character(@character_name_slant) @last_slant = true end end sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch self.src_rect.set(sx, sy, @cw, @ch) end end
20 Bytes, 阅读权限: 255, 下载次数: 4
作废!!!
搜狗截图13年06月29日2050_9.png (8.91 KB, 下载次数: 30)
错误信息
QQ图片20130707201449.jpg (6.41 KB, 下载次数: 26)
721.42 KB, 下载次数: 115
试试更新的,bug我会再补,前一阵太忙了
Battle_Cursor.png (5.86 KB, 下载次数: 34)
Battle_Cursor.png
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |