Project1
标题:
伪八方向脚本怎样配合八方向鼠标寻路
[打印本页]
作者:
qq295268654
时间:
2010-11-26 12:10
标题:
伪八方向脚本怎样配合八方向鼠标寻路
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ ダッシュ&8方向移動 - KGC_Dash_8DirMove ◆
#_/ ◇ Last update : 2007/04/28 ◇
#_/----------------------------------------------------------------------------
#_/ マップ移動時のダッシュ&8方向移動機能を追加します。
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================
# ★ カスタマイズ項目 ★
#==============================================================================
module KGC
# ◆ダッシュボタン
D8DM_DASH_BUTTON = Input::R
# ◆ダッシュ速度
D8DM_DASH_SPEED = 4
# ◆歩行速度
D8DM_WALK_SPEED = 4
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
$imported = {} if $imported == nil
$imported["Dash_8DirMove"] = true
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
module Dash
#--------------------------------------------------------------------------
# ● 一時ダッシュ速度指定
#--------------------------------------------------------------------------
def self.dash_speed=(value)
$game_system.temp_dash_speed = value
end
#--------------------------------------------------------------------------
# ● 一時歩行速度指定
#--------------------------------------------------------------------------
def self.walk_speed=(value)
$game_system.temp_walk_speed = value
end
#--------------------------------------------------------------------------
# ● 一時ダッシュ/歩行速度設定を解除
#--------------------------------------------------------------------------
def self.reset_speed
$game_system.temp_dash_speed = nil
$game_system.temp_walk_speed = nil
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :dash_permit # ダッシュ許可フラグ
attr_accessor :dir8_permit # 8方向移動許可フラグ
attr_accessor :temp_dash_speed # ダッシュ速度(一時)
attr_accessor :temp_walk_speed # 歩行速度(一時)
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_Dash_8DirMove initialize
def initialize
initialize_KGC_Dash_8DirMove
@dash_permit = true
@dir8_permit = true
@temp_dash_speed = nil
@temp_walk_speed = nil
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
# ローカル変数に移動中かどうかを記憶
last_moving = moving?
# 移動中、イベント実行中、移動ルート強制中、
# メッセージウィンドウ表示中のいずれでもない場合
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
# 向きを保存
direction = @direction
# 方向ボタンが押されていれば、その方向へプレイヤーを移動
if $game_system.dir8_permit
case Input.dir8
when 1 # 左下
move_left
move_down
# 向き固定でない場合
unless @direction_fix
# 右向きだった場合は左を、上向きだった場合は下を向く
@direction = (direction == 6 ? 4 : direction == 8 ? 2 : direction)
end
when 2 # 下
move_down
when 3 # 右下
move_down
move_right
# 向き固定でない場合
unless @direction_fix
# 左向きだった場合は右を、上向きだった場合は下を向く
@direction = (direction == 4 ? 6 : direction == 8 ? 2 : direction)
end
when 4 # 左
move_left
when 6 # 右
move_right
when 7 # 左上
move_up
move_left
# 向き固定でない場合
unless @direction_fix
# 右向きだった場合は左を、下向きだった場合は上を向く
@direction = (direction == 6 ? 4 : direction == 2 ? 8 : direction)
end
when 8 # 上
move_up
when 9 # 右上
move_right
move_up
# 向き固定でない場合
unless @direction_fix
# 左向きだった場合は右を、下向きだった場合は上を向く
@direction = (direction == 4 ? 6 : direction == 2 ? 8 : direction)
end
end
else
case Input.dir4
when 2
move_down
when 4
move_left
when 6
move_right
when 8
move_up
end
end
# 歩行速度調整
if $game_system.dash_permit && Input.press?(KGC::D8DM_DASH_BUTTON)
if $game_system.temp_dash_speed == nil
@move_speed = KGC::D8DM_DASH_SPEED
else
@move_speed = $game_system.temp_dash_speed
end
else
if $game_system.temp_walk_speed == nil
@move_speed = KGC::D8DM_WALK_SPEED
else
@move_speed = $game_system.temp_walk_speed
end
end
end
# ローカル変数に座標を記憶
last_real_x = @real_x
last_real_y = @real_y
super
# キャラクターが下に移動し、かつ画面上の位置が中央より下の場合
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
# マップを下にスクロール
$game_map.scroll_down(@real_y - last_real_y)
end
# キャラクターが左に移動し、かつ画面上の位置が中央より左の場合
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
# マップを左にスクロール
$game_map.scroll_left(last_real_x - @real_x)
end
# キャラクターが右に移動し、かつ画面上の位置が中央より右の場合
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
# マップを右にスクロール
$game_map.scroll_right(@real_x - last_real_x)
end
# キャラクターが上に移動し、かつ画面上の位置が中央より上の場合
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
# マップを上にスクロール
$game_map.scroll_up(last_real_y - @real_y)
end
# 移動中ではない場合
unless moving?
# 前回プレイヤーが移動中だった場合
if last_moving
# 同位置のイベントとの接触によるイベント起動判定
result = check_event_trigger_here([1,2])
# 起動したイベントがない場合
if result == false
# デバッグモードが ON かつ CTRL キーが押されている場合を除き
unless $DEBUG and Input.press?(Input::CTRL)
# エンカウント カウントダウン
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
# C ボタンが押された場合
if Input.trigger?(Input::C)
# 同位置および正面のイベント起動判定
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
复制代码
我用了伪八方向脚本,请问怎样配合八方向鼠标寻路脚本,还有,貌似连鼠标响应都用不了了,如何解决
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1