查看: 3111|回复: 10

[已经解决] 有一个重力跳跃+全方位移动脚本,想把全方位移动去掉

[复制链接]
梦石
3
星屑
1640
在线时间
198 小时
注册时间
2018-7-10
回帖
299
发表于 2019-1-2 15:04:01 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 番茄幽灵 于 2019-1-27 18:29 编辑

问题已解决,请告诉我怎么结贴qaq
----------------------
大家好,我是茄灵。
不知道从别人的帖子那里拿脚本可不可以,如果不可以还请大家说一声,我会删掉。
如题,我完全不会脚本,现在有一个重力跳跃+全方位移动脚本,
我只想要其中的重力跳跃功能,请告诉我修改的方法,感激不尽qvq
脚本在此:
  1. $ud_ok = true #上下失效
  2. $airjump = 2  #空中连跳
  3. #==============================================================================
  4. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  5. #==============================================================================

  6. # ————————————————————————————————————
  7. # 全方向ドット移動 Ver ε
  8. # 配布元・サポートURL
  9. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]

  10. #==============================================================================
  11. # ■ Game_Player
  12. #------------------------------------------------------------------------------
  13. #  プレイヤーを扱うクラスです。イベントの起動判定や、マップのスクロールなどの
  14. # 機能を持っています。このクラスのインスタンスは $game_player で参照されます。
  15. #==============================================================================
  16. class Game_Player < Game_Character
  17.   #--------------------------------------------------------------------------
  18.   # ● 定数
  19.   #--------------------------------------------------------------------------
  20.   UP    = 63                  # 上方向の余裕(0 < UP < 63)
  21.   DOWN  = 16                  # 下方向の余裕(0 < DOWN <63)
  22.   SIDE  = 32                  # 左右方向の余裕(0 < SIDE <63)
  23.   SLANT = false               # 移動ルートの斜め移動時、速度修正
  24.   JUMPMAX = 100        
  25.   JUMPADD = 10            
  26.   #--------------------------------------------------------------------------
  27.   # ● 公開インスタンス変数
  28.   #--------------------------------------------------------------------------
  29.   attr_reader   :event                    # イベント時移動速度
  30.   attr_accessor :move_speed               # 移動速度
  31.   #--------------------------------------------------------------------------
  32.   # ● フレーム更新
  33.   #--------------------------------------------------------------------------
  34.   alias :update_original :update
  35.   def update
  36.     # @walk:歩行速度 @dash:ダッシュ時移動速度
  37.     # @event:イベント時移動速度(0の時は、イベント時に速度変更をしない)
  38.     @walk  = 4
  39.     @dash  = 5
  40.     @event = 4
  41.     @dot_m = true
  42.     #ダッシュ機能。エンターキーが押されている間、移動速度を変更する。
  43.     unless moving? or $game_system.map_interpreter.running? or
  44.             @move_route_forcing or $game_temp.message_window_showing
  45.       if @walk != @dash
  46.         if Input.press?(Input::C)
  47.           if @move_speed != @dash
  48.             @move_speed = @dash
  49.           end
  50.         else
  51.           if @move_speed != @walk
  52.             @move_speed = @walk
  53.           end
  54.         end
  55.       end
  56.     end
  57.     if @revise_x == nil and @revise_y == nil
  58.       @revise_x = 0
  59.       @revise_y = 0
  60.     end
  61.     unless @dot_m
  62.       update_original
  63.       return
  64.     end
  65.     if @move_route_forcing
  66.       # ローカル変数に移動中かどうかを記憶
  67.       last_moving = moving?
  68.       # ローカル変数に座標を記憶
  69.       last_real_x = @real_x
  70.       last_real_y = @real_y
  71.       # 座標がずれている場合
  72.       if (@revise_x != 0 or @revise_y != 0) and not jumping? and @move == true
  73.         if @revise_x != @real_x - @x * 128 or @revise_y != @real_y - @y * 128
  74.           @revise_x = @real_x - @x * 128
  75.           @revise_y = @real_y - @y * 128
  76.         end
  77.         # 移動距離distance1と目標距離distance2を設定
  78.         distance1 = 2 ** @move_speed
  79.         distance2 = Math.sqrt(@revise_x ** 2 + @revise_y ** 2)
  80.         # 移動距離が目標距離を越えた場合
  81.         if distance1 > distance2
  82.           # 強制的に補正座標を零にする
  83.           @real_x = @real_x - @revise_x
  84.           @real_y = @real_y - @revise_y
  85.           @revise_x = 0
  86.           @revise_y = 0
  87.           anime_update
  88.         # 移動距離が目標距離に達しない場合
  89.         else
  90.           # 移動距離分目標距離に近づく
  91.           @real_x -= (distance1 * @revise_x / distance2).round
  92.           @real_y -= (distance1 * @revise_y / distance2).round
  93.           @revise_x = @real_x - @x * 128
  94.           @revise_y = @real_y - @y * 128
  95.           anime_update
  96.         end
  97.       else
  98.         super
  99.       end
  100.     else
  101.       @move = false
  102.       # 移動中、イベント実行中、移動ルート強制中、
  103.       # メッセージウィンドウ表示中のいずれでもない場合
  104.       unless moving? or $game_system.map_interpreter.running? or
  105.              @move_route_forcing or $game_temp.message_window_showing
  106.         @event_run = false
  107.         # 方向ボタンが押されていれば、その方向へプレイヤーを移動
  108. #---------------------------上下失效-----------------------------------------
  109.       case Input.dir8
  110.         when 1
  111.           $ud_ok ? move_lower_left_p : move_left_p
  112.         when 2
  113. #          $ud_ok ? move_down_p : move_down_aaaagq
  114.           move_down_p if $ud_ok
  115.         when 3
  116.          $ud_ok ? move_lower_right_p : move_right_p
  117.         when 4
  118.           move_left_p
  119.         when 6
  120.           move_right_p
  121.         when 7
  122.          $ud_ok ? move_upper_left_p : move_left_p
  123.         when 8
  124. #         $ud_ok ? move_up_p : move_up_aaaagq
  125.          move_up_p if $ud_ok
  126.         when 9
  127.          $ud_ok ? move_upper_right_p : move_right_p
  128.         end
  129.       end
  130.       # ローカル変数に座標を記憶
  131.       last_real_x = @real_x
  132.       last_real_y = @real_y
  133.       # 移動処理
  134.       @real_x = @x * 128 + @revise_x
  135.       @real_y = @y * 128 + @revise_y
  136.       # ローカル変数に移動中かどうかを記憶
  137.       last_moving = moving?
  138.       # 座標更新
  139.       move_on
  140.       # 現在の座標と以前の座標が異なる場合
  141.       if (last_real_x != @real_x or last_real_y != @real_y)
  142.         @move_distance = 0 if @move_distance == nil
  143.         @move_distance += Math.sqrt((last_real_x - @real_x) ** 2 +
  144.                                       (last_real_y - @real_y) ** 2)
  145.         if @move_distance >= 128
  146.           @move_distance %= 128
  147.           increase_steps
  148.         end
  149.         # アニメーションを更新
  150.         anime_update
  151.       else
  152.         @pattern = 0
  153.       end
  154.     end
  155.     # キャラクターが下に移動し、かつ画面上の位置が中央より下の場合
  156.     if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  157.       # マップを下にスクロール
  158.       $game_map.scroll_down(@real_y - last_real_y)
  159.     end
  160.     # キャラクターが左に移動し、かつ画面上の位置が中央より左の場合
  161.     if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  162.       # マップを左にスクロール
  163.       $game_map.scroll_left(last_real_x - @real_x)
  164.     end
  165.     # キャラクターが右に移動し、かつ画面上の位置が中央より右の場合
  166.     if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  167.       # マップを右にスクロール
  168.       $game_map.scroll_right(@real_x - last_real_x)
  169.     end
  170.     # キャラクターが上に移動し、かつ画面上の位置が中央より上の場合
  171.     if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  172.       # マップを上にスクロール
  173.       $game_map.scroll_up(last_real_y - @real_y)
  174.     end
  175.     # 前回プレイヤーが移動中だった場合
  176.     if last_moving
  177.       # 同位置のイベントとの接触によるイベント起動判定
  178.       result = check_event_trigger_here([1,2])
  179.       if result == true
  180.         if (last_real_x / 128.0).round != @x and
  181.             (last_real_y / 128.0).round != @y
  182.           if @direction == 2 or @direction == 8
  183.             if (last_real_x / 128.0).round > @x
  184.               turn_left
  185.             else
  186.               turn_right
  187.             end
  188.           else
  189.             if (last_real_y / 128.0).round > @y
  190.               turn_up
  191.             else
  192.               turn_down
  193.             end
  194.           end
  195.         elsif (last_real_x / 128.0).round > @x
  196.           turn_left
  197.         elsif (last_real_x / 128.0).round < @x
  198.           turn_right
  199.         elsif (last_real_y / 128.0).round > @y
  200.           turn_up
  201.         elsif (last_real_y / 128.0).round < @y
  202.           turn_down
  203.         end
  204.       end
  205.       # 起動したイベントがない場合
  206.       if result == false
  207.         # デバッグモードが ON かつ CTRL キーが押されている場合を除き
  208.         unless $DEBUG and Input.press?(Input::CTRL)
  209.           # エンカウント カウントダウン
  210.           if @encounter_count > 0
  211.             @encounter_count -= 1
  212.           end
  213.         end
  214.       end
  215.     end
  216. #-----------------------按跳跃-----------------------------------------------
  217. # A ボタンが押された場合
  218.     if Input.press?(Input::A) and not $ud_ok
  219.       @twojump = 1 if @twojump == 0 and down1(((@x * 128 + @revise_x) / 128.0).round,
  220.           ((@y * 128 + @revise_y) / 128.0).round, 5, true)
  221.       if (not @apassed) and @twojump <= $airjump
  222.         @apassed = true
  223.         @jumpnow = JUMPMAX
  224.         @twojump += 1
  225.       else
  226.         @jumpnow += 3        
  227.       end
  228.     else
  229.       @apassed = false
  230.     end
  231. #----------------------自由落体--------------------------------
  232.     if not $ud_ok
  233.       @jumpnow -= 10
  234.       if @jumpnow < 0
  235.         @jumpnow = [@jumpnow, -JUMPMAX].max
  236.         if not down1(((@x * 128 + @revise_x) / 128.0).round,
  237.           ((@y * 128 + @revise_y) / 128.0).round, -@jumpnow, true)
  238.           @jumpnow = 0
  239.           @twojump = 0
  240.         end
  241.       elsif @jumpnow > 0
  242.         @jumpnow = [@jumpnow, JUMPMAX].min
  243.         if not up1(((@x * 128 + @revise_x) / 128.0).round,
  244.           ((@y * 128 + @revise_y) / 128.0).round, @jumpnow, true)
  245.           @jumpnow = 0
  246.         end
  247.       end
  248.     end
  249.     if Input.trigger?(Input::C)
  250.       # 同位置および正面のイベント起動判定
  251.       check_event_trigger_here([0])
  252.       check_event_trigger_there([0,1,2])
  253.     end
  254.   end
  255.   #--------------------------------------------------------------------------
  256.   # ● オブジェクト初期化
  257.   #--------------------------------------------------------------------------
  258.   def initialize
  259.     @jumpnow = 0
  260.     @twojump = 0
  261.     @apassed = false
  262.     @revise_x = 0
  263.     @revise_y = 0
  264.     @move == false
  265.     super
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● 移動判定
  269.   #--------------------------------------------------------------------------
  270.   def moving?
  271.     unless @dot_m
  272.       result = super
  273.       return result
  274.     end
  275.     # 強制移動の場合オリジナルの判定をさせる
  276.     if @move_route_forcing
  277.       if @move == false
  278.         return false
  279.       end
  280.       super
  281.     # 通常時は現座標が実座標と異なる場合のみ移動中と判定
  282.     else
  283.       return (@x != (@real_x / 128.0).round or @y != (@real_y / 128.0).round)
  284.     end
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # ● 移動判定
  288.   #--------------------------------------------------------------------------
  289.   def moving_a?
  290.     if @move == false
  291.       if (@move_route.list[@move_route_index].code <= 14 or
  292.           @move_route.list[@move_route_index].code == 25)
  293.         @move = true
  294.       end
  295.       return false
  296.     end
  297.     moving?
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ● フレーム更新 (ジャンプ)
  301.   #--------------------------------------------------------------------------
  302.   def update_jump
  303.     # ジャンプカウントを 1 減らす
  304.     @jump_count -= 1
  305.     # 新しい座標を計算
  306.     @real_x = (@real_x * @jump_count + @x * 128) / (@jump_count + 1)
  307.     @real_y = (@real_y * @jump_count + @y * 128) / (@jump_count + 1)
  308.     if @jump_count == 0
  309.       @revise_x = 0
  310.       @revise_y = 0
  311.     end
  312.   end
  313.   #--------------------------------------------------------------------------
  314.   # ● 移動タイプ : カスタム
  315.   #--------------------------------------------------------------------------
  316.   def move_type_custom
  317.     unless @dot_m
  318.       super
  319.       return
  320.     end
  321.     # 停止中でなければ中断
  322.     if jumping? or moving_a?
  323.       return
  324.     end
  325.     # 移動コマンドのリストの最後に到達するまでループ
  326.     while @move_route_index < @move_route.list.size
  327.       # 移動コマンドを取得
  328.       command = @move_route.list[@move_route_index]
  329.       # コマンドコード 0 番 (リストの最後) の場合
  330.       if command.code == 0
  331.         # オプション [動作を繰り返す] が ON の場合
  332.         if @move_route.repeat
  333.           # 移動ルートのインデックスを最初に戻す
  334.           @move_route_index = 0
  335.         end
  336.         # オプション [動作を繰り返す] が OFF の場合
  337.         unless @move_route.repeat
  338.           # 移動ルート強制中の場合
  339.           if @move_route_forcing and not @move_route.repeat
  340.             # 移動ルートの強制を解除
  341.             @move_route_forcing = false
  342.             # オリジナルの移動ルートを復帰
  343.             @move_route = @original_move_route
  344.             @move_route_index = @original_move_route_index
  345.             @original_move_route = nil
  346.           end
  347.           # 停止カウントをクリア
  348.           @stop_count = 0
  349.         end
  350.         return
  351.       end
  352.       # 移動系コマンド (下に移動~ジャンプ) の場合
  353.       if command.code <= 14
  354.         # コマンドコードで分岐
  355.         case command.code
  356.         when 1  # 下に移動
  357.           move_down
  358.         when 2  # 左に移動
  359.           move_left
  360.         when 3  # 右に移動
  361.           move_right
  362.         when 4  # 上に移動
  363.           move_up
  364.         when 5  # 左下に移動
  365.           move_lower_left
  366.         when 6  # 右下に移動
  367.           move_lower_right
  368.         when 7  # 左上に移動
  369.           move_upper_left
  370.         when 8  # 右上に移動
  371.           move_upper_right
  372.         when 9  # ランダムに移動
  373.           move_random
  374.         when 10  # プレイヤーに近づく
  375.           move_toward_player
  376.         when 11  # プレイヤーから遠ざかる
  377.           move_away_from_player
  378.         when 12  # 一歩前進
  379.           move_forward
  380.         when 13  # 一歩後退
  381.           move_backward
  382.         when 14  # ジャンプ
  383.           jump(command.parameters[0], command.parameters[1])
  384.         end
  385.         # オプション [移動できない場合は無視] が OFF で、移動失敗の場合
  386.         if not @move_route.skippable and not moving? and not jumping?
  387.           return
  388.         end
  389.         @move_route_index += 1
  390.         return
  391.       end
  392.       # ウェイトの場合
  393.       if command.code == 15
  394.         # ウェイトカウントを設定
  395.         @wait_count = command.parameters[0] * 2 - 1
  396.         @move_route_index += 1
  397.         return
  398.       end
  399.       # 向き変更系のコマンドの場合
  400.       if command.code >= 16 and command.code <= 26
  401.         # コマンドコードで分岐
  402.         case command.code
  403.         when 16  # 下を向く
  404.           turn_down
  405.         when 17  # 左を向く
  406.           turn_left
  407.         when 18  # 右を向く
  408.           turn_right
  409.         when 19  # 上を向く
  410.           turn_up
  411.         when 20  # 右に 90 度回転
  412.           turn_right_90
  413.         when 21  # 左に 90 度回転
  414.           turn_left_90
  415.         when 22  # 180 度回転
  416.           turn_180
  417.         when 23  # 右か左に 90 度回転
  418.           turn_right_or_left_90
  419.         when 24  # ランダムに方向転換
  420.           turn_random
  421.         when 25  # プレイヤーの方を向く
  422.           turn_toward_player
  423.         when 26  # プレイヤーの逆を向く
  424.           turn_away_from_player
  425.         end
  426.         @move_route_index += 1
  427.         return
  428.       end
  429.       # その他のコマンドの場合
  430.       if command.code >= 27
  431.         # コマンドコードで分岐
  432.         case command.code
  433.         when 27  # スイッチ ON
  434.           $game_switches[command.parameters[0]] = true
  435.           $game_map.need_refresh = true
  436.         when 28  # スイッチ OFF
  437.           $game_switches[command.parameters[0]] = false
  438.           $game_map.need_refresh = true
  439.         when 29  # 移動速度の変更
  440.           @move_speed = command.parameters[0]
  441.         when 30  # 移動頻度の変更
  442.           @move_frequency = command.parameters[0]
  443.         when 31  # 移動時アニメ ON
  444.           @walk_anime = true
  445.         when 32  # 移動時アニメ OFF
  446.           @walk_anime = false
  447.         when 33  # 停止時アニメ ON
  448.           @step_anime = true
  449.         when 34  # 停止時アニメ OFF
  450.           @step_anime = false
  451.         when 35  # 向き固定 ON
  452.           @direction_fix = true
  453.         when 36  # 向き固定 OFF
  454.           @direction_fix = false
  455.         when 37  # すり抜け ON
  456.           @through = true
  457.         when 38  # すり抜け OFF
  458.           @through = false
  459.         when 39  # 最前面に表示 ON
  460.           @always_on_top = true
  461.         when 40  # 最前面に表示 OFF
  462.           @always_on_top = false
  463.         when 41  # グラフィック変更
  464.           @tile_id = 0
  465.           @character_name = command.parameters[0]
  466.           @character_hue = command.parameters[1]
  467.           if @original_direction != command.parameters[2]
  468.             @direction = command.parameters[2]
  469.             @original_direction = @direction
  470.             @prelock_direction = 0
  471.           end
  472.           if @original_pattern != command.parameters[3]
  473.             @pattern = command.parameters[3]
  474.             @original_pattern = @pattern
  475.           end
  476.         when 42  # 不透明度の変更
  477.           @opacity = command.parameters[0]
  478.         when 43  # 合成方法の変更
  479.           @blend_type = command.parameters[0]
  480.         when 44  # SE の演奏
  481.           $game_system.se_play(command.parameters[0])
  482.         when 45  # スクリプト
  483.           result = eval(command.parameters[0])
  484.         end
  485.         @move_route_index += 1
  486.         return
  487.       end
  488.     end
  489.   end
  490.   #--------------------------------------------------------------------------
  491.   # ● 下に移動
  492.   #--------------------------------------------------------------------------
  493.   def move_down_p
  494.     # 下を向く
  495.     turn_down
  496.     # 移動距離を算出
  497.     distance = 2 ** @move_speed
  498.     down1(((@x * 128 + @revise_x) / 128.0).round,
  499.           ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  500.   end
  501.   def move_down_aaaagq
  502.     distance = 2 ** @move_speed
  503.     down1(((@x * 128 + @revise_x) / 128.0).round,
  504.           ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  505.   end
  506.   #--------------------------------------------------------------------------
  507.   # ● 下に移動可能かどうかの判定1
  508.   #--------------------------------------------------------------------------
  509.   def down1(x, y, distance, down = false)
  510.     result = down2(x, y, distance)
  511.     if result == false
  512.       @event_run = check_event_trigger_touch(x, y+1)
  513.       return result
  514.     end
  515.     if @revise_x < -SIDE
  516.       result = down2(x, y + 1, distance, 4)
  517.       result &= down2(x - 1, y, distance)
  518.       if result == false
  519.         if down
  520.           move_lower_right_p
  521.           if @revise_x > SIDE
  522.             @revise_x = SIDE
  523.           end
  524.         end
  525.         return result
  526.       end
  527.     elsif @revise_x > SIDE
  528.       result = down2(x, y + 1, distance, 6)
  529.       result &= down2(x + 1, y, distance)
  530.       if result == false
  531.         if down
  532.           move_lower_left_p
  533.           if @revise_x < -SIDE
  534.             @revise_x = -SIDE
  535.           end
  536.         end
  537.         return result
  538.       end
  539.     end
  540.     # 下に移動可能ならば距離分移動
  541.     @revise_y += distance
  542.     return result
  543.   end
  544.   #--------------------------------------------------------------------------
  545.   # ● 下に移動可能かどうかの判定2
  546.   #--------------------------------------------------------------------------
  547.   def down2(x, y, distance, d = 2)
  548.     if @revise_y + distance > DOWN
  549.       unless passable?(x, y, d)
  550.         if @revise_y < DOWN
  551.           @revise_y = DOWN
  552.         end
  553.         return false
  554.       end
  555.     end
  556.     return true
  557.   end
  558.   #--------------------------------------------------------------------------
  559.   # ● 左に移動
  560.   #--------------------------------------------------------------------------
  561.   def move_left_p
  562.     # 左を向く
  563.     turn_left
  564.     distance = 2 ** @move_speed
  565.     left1(((@x * 128 + @revise_x) / 128.0).round,
  566.           ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  567.   end
  568.   #--------------------------------------------------------------------------
  569.   # ● 左に移動可能かどうかの判定1
  570.   #--------------------------------------------------------------------------
  571.   def left1(x, y, distance, left = false)
  572.     result = left2(x, y, distance)
  573.     if result == false
  574.       @event_run = check_event_trigger_touch(x-1, y)
  575.       return result
  576.     end
  577.     if @revise_y < -UP and $ud_ok
  578.       result = left2(x - 1, y, distance, 8)
  579.       result &= left2(x, y - 1, distance)
  580.       if result == false
  581.         if left
  582.           move_lower_left_p
  583.           if @revise_y > DOWN
  584.             @revise_y = DOWN
  585.           end
  586.         end
  587.         return result
  588.       end
  589.     elsif @revise_y > DOWN and $ud_ok
  590.       result = left2(x - 1, y, distance, 2)
  591.       result &= left2(x, y + 1, distance)
  592.       if result == false
  593.         if left
  594.           move_upper_left_p
  595.           if @revise_y < -UP
  596.             @revise_y = -UP
  597.           end
  598.         end
  599.         return result
  600.       end
  601.     end
  602.     @revise_x -= distance
  603.     return result
  604.   end
  605.   #--------------------------------------------------------------------------
  606.   # ● 左に移動可能かどうかの判定2
  607.   #--------------------------------------------------------------------------
  608.   def left2(x, y, distance, d = 4)
  609.     if @revise_x - distance < -SIDE
  610.       unless passable?(x, y, d)
  611.         if @revise_x > -SIDE
  612.           @revise_x = -SIDE
  613.         end
  614.         return false
  615.       end
  616.     end
  617.     return true
  618.   end
  619.   #--------------------------------------------------------------------------
  620.   # ● 右に移動
  621.   #--------------------------------------------------------------------------
  622.   def move_right_p
  623.       # 右を向く
  624.       turn_right
  625.     distance = 2 ** @move_speed
  626.     right1(((@x * 128 + @revise_x) / 128.0).round,
  627.             ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # ● 右に移動可能かどうかの判定1
  631.   #--------------------------------------------------------------------------
  632.   def right1(x, y, distance, right = false)
  633.     result = right2(x, y, distance)
  634.     if result == false
  635.       @event_run = check_event_trigger_touch(x+1, y)
  636.       return result
  637.     end
  638.     if @revise_y < -UP and $ud_ok
  639.       result = right2(x + 1, y, distance, 8)
  640.       result &= right2(x, y - 1, distance)
  641.       if result == false
  642.         if right
  643.           move_lower_right_p
  644.           if @revise_y > DOWN
  645.             @revise_y = DOWN
  646.           end
  647.         end
  648.         return result
  649.       end
  650.     elsif @revise_y > DOWN and $ud_ok
  651.       result = right2(x + 1, y, distance, 2)
  652.       result &= right2(x, y + 1, distance)
  653.       if result == false
  654.         if right
  655.           move_upper_right_p
  656.           if @revise_y < -UP
  657.             @revise_y = -UP
  658.           end
  659.         end
  660.         return result
  661.       end
  662.     end
  663.     @revise_x += distance
  664.     return result
  665.   end
  666.   #--------------------------------------------------------------------------
  667.   # ● 右に移動可能かどうかの判定2
  668.   #--------------------------------------------------------------------------
  669.   def right2(x, y, distance, d = 6)
  670.     if @revise_x + distance > SIDE
  671.       unless passable?(x, y, d)
  672.         if @revise_x < SIDE
  673.           @revise_x = SIDE
  674.         end
  675.         return false
  676.       end
  677.     end
  678.     return true
  679.   end
  680.   #--------------------------------------------------------------------------
  681.   # ● 上に移動
  682.   #--------------------------------------------------------------------------
  683.   def move_up_p
  684.     # 上を向く
  685.     turn_up
  686.     # 下に移動
  687.     distance = 2 ** @move_speed
  688.     up1(((@x * 128 + @revise_x) / 128.0).round,
  689.         ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  690.   end
  691.   def move_up_aaaagq
  692.     distance = 2 ** @move_speed
  693.     up1(((@x * 128 + @revise_x) / 128.0).round,
  694.         ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  695.   end
  696.   #--------------------------------------------------------------------------
  697.   # ● 上に移動可能かどうかの判定1
  698.   #--------------------------------------------------------------------------
  699.   def up1(x, y, distance, up = false)
  700.     result = up2(x, y, distance)
  701.     if result == false
  702.       @event_run = check_event_trigger_touch(x, y-1)
  703.       return result
  704.     end
  705.     if @revise_x < -SIDE
  706.       result = up2(x, y - 1, distance, 4)
  707.       result &= up2(x - 1, y, distance)
  708.       if result == false
  709.         if up
  710.           move_upper_right_p
  711.           if @revise_x > SIDE
  712.             @revise_x = SIDE
  713.           end
  714.         end
  715.         return result
  716.       end
  717.     elsif @revise_x > SIDE
  718.       result = up2(x, y - 1, distance, 6)
  719.       result &= up2(x + 1, y, distance)
  720.       if result == false
  721.         if up
  722.           move_upper_left_p
  723.           if @revise_x < -SIDE
  724.             @revise_x = -SIDE
  725.           end
  726.         end
  727.         return result
  728.       end
  729.     end
  730.     @revise_y -= distance
  731.     return result
  732.   end
  733.   #--------------------------------------------------------------------------
  734.   # ● 上に移動可能かどうかの判定2
  735.   #--------------------------------------------------------------------------
  736.   def up2(x, y, distance, d = 8)
  737.     if @revise_y - distance < -UP
  738.       unless passable?(x, y, d)
  739.         if @revise_y > -UP
  740.           @revise_y = -UP
  741.         end
  742.         return false
  743.       end
  744.     end
  745.     return true
  746.   end
  747.   #--------------------------------------------------------------------------
  748.   # ● 左下に移動
  749.   #--------------------------------------------------------------------------
  750.   def move_lower_left_p
  751.     # 向き固定でない場合
  752.     unless @direction_fix
  753.       # 右向きだった場合は左を、上向きだった場合は下を向く
  754.       @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
  755.     end
  756.     # 左下に移動
  757.     distance = (2 ** @move_speed) / Math.sqrt(2)
  758.     if @direction == 2
  759.       turn_left unless down1(((@x * 128 + @revise_x) / 128.0).round,
  760.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  761.       turn_down if @event_run
  762.       unless @event_run
  763.         if last_move?(@real_x, @real_y, 2, distance)
  764.           result = check_event_trigger_here([1,2], false)
  765.           if result == true
  766.             return
  767.           end
  768.         end
  769.         move_on
  770.         if @revise_y > DOWN and -UP > @revise_y - distance
  771.           @revise_y = DOWN
  772.         end
  773.         turn_down unless left1(((@x * 128 + @revise_x) / 128.0).round,
  774.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  775.         turn_left if @event_run
  776.       end
  777.     else
  778.       turn_down unless left1(((@x * 128 + @revise_x) / 128.0).round,
  779.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  780.       turn_left if @event_run
  781.       unless @event_run
  782.         if last_move?(@real_x, @real_y, 4, distance)
  783.           result = check_event_trigger_here([1,2], false)
  784.           if result == true
  785.             return
  786.           end
  787.         end
  788.         move_on
  789.         if  @revise_x + distance> SIDE and -SIDE > @revise_x
  790.           @revise_x = -SIDE
  791.         end
  792.         turn_left unless down1(((@x * 128 + @revise_x) / 128.0).round,
  793.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  794.         turn_down if @event_run
  795.       end
  796.     end
  797.   end
  798.   #--------------------------------------------------------------------------
  799.   # ● 右下に移動
  800.   #--------------------------------------------------------------------------
  801.   def move_lower_right_p
  802.     # 向き固定でない場合
  803.     unless @direction_fix
  804.       # 左向きだった場合は右を、上向きだった場合は下を向く
  805.       @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
  806.     end
  807.     # 右下に移動
  808.     distance = (2 ** @move_speed) / Math.sqrt(2)
  809.     if @direction == 2
  810.       turn_right unless down1(((@x * 128 + @revise_x) / 128.0).round,
  811.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  812.       turn_down if @event_run
  813.       unless @event_run
  814.         if last_move?(@real_x, @real_y, 2, distance)
  815.           result = check_event_trigger_here([1,2], false)
  816.           if result == true
  817.             return
  818.           end
  819.         end
  820.         move_on
  821.         if @revise_y > DOWN and -UP > @revise_y - distance
  822.           @revise_y = DOWN
  823.         end
  824.         turn_down unless right1(((@x * 128 + @revise_x) / 128.0).round,
  825.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  826.         turn_right if @event_run
  827.       end
  828.     else
  829.       turn_down unless right1(((@x * 128 + @revise_x) / 128.0).round,
  830.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  831.       turn_right if @event_run
  832.       unless @event_run
  833.         if last_move?(@real_x, @real_y, 6, distance)
  834.           result = check_event_trigger_here([1,2], false)
  835.           if result == true
  836.             return
  837.           end
  838.         end
  839.         move_on
  840.         if @revise_x > SIDE and -SIDE > @revise_x - distance
  841.           @revise_x = SIDE
  842.         end
  843.         turn_right unless down1(((@x * 128 + @revise_x) / 128.0).round,
  844.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  845.         turn_down if @event_run
  846.       end
  847.     end
  848.   end
  849.   #--------------------------------------------------------------------------
  850.   # ● 左上に移動
  851.   #--------------------------------------------------------------------------
  852.   def move_upper_left_p
  853.     # 向き固定でない場合
  854.     unless @direction_fix
  855.       # 右向きだった場合は左を、下向きだった場合は上を向く
  856.       @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
  857.     end
  858.     # 左上に移動
  859.     distance = (2 ** @move_speed) / Math.sqrt(2)
  860.     if @direction == 8
  861.       turn_left unless up1(((@x * 128 + @revise_x) / 128.0).round,
  862.                             ((@y * 128 + @revise_y) / 128.0).round, distance)
  863.       turn_up if @event_run
  864.       unless @event_run
  865.         if last_move?(@real_x, @real_y, 8, distance)
  866.           result = check_event_trigger_here([1,2], false)
  867.           if result == true
  868.             return
  869.           end
  870.         end
  871.         move_on
  872.         if @revise_y + distance > DOWN and -UP > @revise_y
  873.           @revise_y = -UP
  874.         end
  875.         turn_up unless left1(((@x * 128 + @revise_x) / 128.0).round,
  876.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  877.         turn_left if @event_run
  878.       end
  879.     else
  880.       turn_up unless left1(((@x * 128 + @revise_x) / 128.0).round,
  881.                             ((@y * 128 + @revise_y) / 128.0).round, distance)
  882.       turn_left if @event_run
  883.       unless @event_run
  884.         if last_move?(@real_x, @real_y, 4, distance)
  885.           result = check_event_trigger_here([1,2], false)
  886.           if result == true
  887.             return
  888.           end
  889.         end
  890.         move_on
  891.         if @revise_x > SIDE and -SIDE > @revise_x - distance
  892.           @revise_x = SIDE
  893.         end
  894.         turn_left unless up1(((@x * 128 + @revise_x) / 128.0).round,
  895.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  896.         turn_up if @event_run
  897.       end
  898.     end
  899.   end
  900.   #--------------------------------------------------------------------------
  901.   # ● 右上に移動
  902.   #--------------------------------------------------------------------------
  903.   def move_upper_right_p
  904.     # 向き固定でない場合
  905.     unless @direction_fix
  906.       # 左向きだった場合は右を、下向きだった場合は上を向く
  907.       @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
  908.     end
  909.     # 右上に移動
  910.     distance = (2 ** @move_speed) / Math.sqrt(2)
  911.     if @direction == 8
  912.       turn_right unless up1(((@x * 128 + @revise_x) / 128.0).round,
  913.                             ((@y * 128 + @revise_y) / 128.0).round, distance)
  914.       turn_up if @event_run
  915.       unless @event_run
  916.         if last_move?(@real_x, @real_y, 8, distance)
  917.           result = check_event_trigger_here([1,2], false)
  918.           if result == true
  919.             return
  920.           end
  921.         end
  922.         move_on
  923.         if @revise_y + distance > DOWN and -UP > @revise_y
  924.           @revise_y = -UP
  925.         end
  926.         turn_up unless right1(((@x * 128 + @revise_x) / 128.0).round,
  927.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  928.         turn_right if @event_run
  929.       end
  930.     else
  931.       turn_up unless right1(((@x * 128 + @revise_x) / 128.0).round,
  932.                             ((@y * 128 + @revise_y) / 128.0).round, distance)
  933.       turn_right if @event_run
  934.       unless @event_run
  935.         if last_move?(@real_x, @real_y, 6, distance)
  936.           result = check_event_trigger_here([1,2], false)
  937.           if result == true
  938.             return
  939.           end
  940.         end
  941.         move_on
  942.         if @revise_x > SIDE and -SIDE > @revise_x - distance
  943.           @revise_x = SIDE
  944.         end
  945.         turn_right unless up1(((@x * 128 + @revise_x) / 128.0).round,
  946.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  947.         turn_up if @event_run
  948.       end
  949.     end
  950.   end
  951.   #--------------------------------------------------------------------------
  952.   # ● 同位置のイベント起動判定
  953.   #--------------------------------------------------------------------------
  954.   def check_event_trigger_here(triggers, run = true)
  955.     result = false
  956.     # イベント実行中の場合
  957.     if $game_system.map_interpreter.running?
  958.       return result
  959.     end
  960.     # 全イベントのループ
  961.     for event in $game_map.events.values
  962.       # イベントの座標とトリガーが一致した場合
  963.       if event.x == ((@x * 128 + @revise_x) / 128.0).round and
  964.           event.y == ((@y * 128 + @revise_y) / 128.0).round and
  965.           triggers.include?(event.trigger)
  966.         # ジャンプ中以外で、起動判定が同位置のイベントなら
  967.         if not event.jumping? and event.over_trigger?
  968.           if event.list.size > 1
  969.             if run == true
  970.               event.start
  971.             end
  972.             result = true
  973.           end
  974.         end
  975.       end
  976.     end
  977.     return result
  978.   end
  979.   #--------------------------------------------------------------------------
  980.   # ● 座標修正
  981.   #--------------------------------------------------------------------------
  982.   def move_on
  983.     if @y < (@y + @revise_y / 128.0).round
  984.       @y += 1
  985.       @revise_y -= 128
  986.     end
  987.     if @x > (@x + @revise_x / 128.0).round
  988.       @x -= 1
  989.       @revise_x += 128
  990.     end
  991.     if @x < (@x + @revise_x / 128.0).round
  992.       @x += 1
  993.       @revise_x -= 128
  994.     end
  995.     if @y > (@y + @revise_y / 128.0).round
  996.       @y -= 1
  997.       @revise_y += 128
  998.     end
  999.   end
  1000.   #--------------------------------------------------------------------------
  1001.   # ● アニメーションアップデート
  1002.   #--------------------------------------------------------------------------
  1003.   def anime_update
  1004.     # 移動時アニメが ON の場合
  1005.     if @walk_anime
  1006.       # アニメカウントを 1.5 増やす
  1007.       @anime_count += 1.5
  1008.     # 移動時アニメが OFF で、停止時アニメが ON の場合
  1009.     elsif @step_anime
  1010.       # アニメカウントを 1 増やす
  1011.       @anime_count += 1
  1012.     end
  1013.     # アニメカウントが最大値を超えた場合
  1014.     # ※最大値は、基本値 18 から移動速度 * 1 を引いた値
  1015.     if @anime_count > 18 - @move_speed * 2
  1016.       # 停止時アニメが OFF かつ 停止中の場合
  1017.       if not @step_anime and @stop_count > 0
  1018.         # パターンをオリジナルに戻す
  1019.         @pattern = @original_pattern
  1020.       # 停止時アニメが ON または 移動中の場合
  1021.       else
  1022.         # パターンを更新
  1023.         @pattern = (@pattern + 1) % 4
  1024.       end
  1025.       # アニメカウントをクリア
  1026.       @anime_count = 0
  1027.     end
  1028.   end
  1029.   #--------------------------------------------------------------------------
  1030.   # ● 指定位置に移動
  1031.   #--------------------------------------------------------------------------
  1032.   # オリジナルのイベントを改名
  1033.   alias :moveto_original :moveto
  1034.   def moveto(x, y)
  1035.     # 補正座標を初期化
  1036.     @revise_x = 0
  1037.     @revise_y = 0
  1038.     # オリジナルのイベントを呼び出し
  1039.     moveto_original(x, y)
  1040.   end
  1041.   #--------------------------------------------------------------------------
  1042.   # ● 移動したかどうかの判定
  1043.   #--------------------------------------------------------------------------
  1044.   def last_move?(x, y, direction, distance)
  1045.     if direction == 2 or direction == 6
  1046.       distance *= -1
  1047.     end
  1048.     if (direction == 2 or direction == 8) and
  1049.         (y / 128.0).round != ((y - distance) / 128.0).round
  1050.       return true
  1051.     end
  1052.     if (direction == 4 or direction == 6) and
  1053.         (x / 128.0).round != ((x - distance) / 128.0).round
  1054.       return true
  1055.     end
  1056.     return false
  1057.   end
  1058. end

  1059. #==============================================================================
  1060. # ■ Game_Character (分割定義 1)
  1061. #------------------------------------------------------------------------------
  1062. #  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
  1063. # クラスのスーパークラスとして使用されます。
  1064. #==============================================================================

  1065. class Game_Character
  1066.   #--------------------------------------------------------------------------
  1067.   # ● フレーム更新 (移動)
  1068.   #--------------------------------------------------------------------------
  1069.   def update_move
  1070.     # 移動速度からマップ座標系での移動距離に変換
  1071.     distance = 2 ** @move_speed
  1072.     if @x * 128 != @real_x and @y * 128 != @real_y and Game_Player::SLANT
  1073.       distance /= Math.sqrt(2)
  1074.     end
  1075.     # 論理座標が実座標より下の場合
  1076.     if @y * 128 > @real_y
  1077.       # 下に移動
  1078.       @real_y = [@real_y + distance, @y * 128].min
  1079.     end
  1080.     # 論理座標が実座標より左の場合
  1081.     if @x * 128 < @real_x
  1082.       # 左に移動
  1083.       @real_x = [@real_x - distance, @x * 128].max
  1084.     end
  1085.     # 論理座標が実座標より右の場合
  1086.     if @x * 128 > @real_x
  1087.       # 右に移動
  1088.       @real_x = [@real_x + distance, @x * 128].min
  1089.     end
  1090.     # 論理座標が実座標より上の場合
  1091.     if @y * 128 < @real_y
  1092.       # 上に移動
  1093.       @real_y = [@real_y - distance, @y * 128].max
  1094.     end
  1095.     # 移動時アニメが ON の場合
  1096.     if @walk_anime
  1097.       # アニメカウントを 1.5 増やす
  1098.       @anime_count += 1.5
  1099.     # 移動時アニメが OFF で、停止時アニメが ON の場合
  1100.     elsif @step_anime
  1101.       # アニメカウントを 1 増やす
  1102.       @anime_count += 1
  1103.     end
  1104.   end
  1105. end

  1106. #==============================================================================
  1107. # ■ Game_Event
  1108. #------------------------------------------------------------------------------
  1109. #  イベントを扱うクラスです。条件判定によるイベントページ切り替えや、並列処理
  1110. # イベント実行などの機能を持っており、Game_Map クラスの内部で使用されます。
  1111. #==============================================================================

  1112. class Game_Event < Game_Character
  1113.   #--------------------------------------------------------------------------
  1114.   # ● イベント起動
  1115.   #--------------------------------------------------------------------------
  1116.   def start
  1117.     # 実行内容が空でない場合
  1118.     if @list.size > 1
  1119.       # $game_player.event が0でない場合
  1120.       if $game_player.event != 0
  1121.         # 移動速度を $game_player.event にする
  1122.         $game_player.move_speed = $game_player.event
  1123.       end
  1124.       @starting = true
  1125.     end
  1126.   end
  1127. end

  1128. #==============================================================================
  1129. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  1130. #==============================================================================
复制代码

点评

这脚本留着原始的那个 配布元・サポートURL就行了,那个是原作者,其他的都是修改的版本。  发表于 2019-1-3 04:39
梦石
3
星屑
1640
在线时间
198 小时
注册时间
2018-7-10
回帖
299
 楼主| 发表于 2019-1-2 15:56:53 | 显示全部楼层
或者有人能告诉我自己写的思路也行!跪求
回复

使用道具 举报

梦石
10
星屑
39550
在线时间
1919 小时
注册时间
2010-11-14
回帖
3214

R考场第七期纪念奖

发表于 2019-1-2 18:47:55 | 显示全部楼层
本帖最后由 KB.Driver 于 2019-1-2 18:50 编辑

脚本跑不了。
先是与@followers冲突
把所有followers相关的修正后,还有CENTER_Y未初始化
全局搜索了一下,改成了center_y,又未定义方法。
怀疑你是不是少发了代码(比如需要配合某基础脚本共同使用)

没法跑就随便说一句吧,从355行开始,
  1. if command.code <= 14
  2.         # コマンドコードで分岐
  3.         case command.code
  4.         when 1  # 下に移動
  5.           move_down
  6.         when 2  # 左に移動
  7.           move_left
  8.         when 3  # 右に移動
  9.           move_right
  10.         when 4  # 上に移動
  11.           move_up
  12.         when 5  # 左下に移動
  13.           move_lower_left
  14.         when 6  # 右下に移動
  15.           move_lower_right
  16.         when 7  # 左上に移動
  17.           move_upper_left
  18.         when 8  # 右上に移動
  19.           move_upper_right
  20.         when 9  # ランダムに移動
  21.           move_random
  22.         when 10  # プレイヤーに近づく
  23.           move_toward_player
  24.         when 11  # プレイヤーから遠ざかる
  25.           move_away_from_player
  26.         when 12  # 一歩前進
  27.           move_forward
  28.         when 13  # 一歩後退
  29.           move_backward
  30.         when 14  # ジャンプ
  31.           jump(command.parameters[0], command.parameters[1])
  32.         end
复制代码

你把从when 5 到when 8结束的部分(这里的12~19行)注释掉看看

点评

全方位移动取消了,但是这个脚本还有个功能是,人物移动的时候会精确到每个像素……想把这个也取消掉应该怎么办呢  发表于 2019-1-2 19:04
谢谢您的回复!我试试看  发表于 2019-1-2 18:57
请问跑不了是指游戏无法运行吗?我这边可以照常运行,跳跃也没有问题  发表于 2019-1-2 18:56

评分

参与人数 2星屑 +100 赞 +2 收起 理由
RyanBern + 100 + 1 认可答案
番茄幽灵 + 1 认可答案

查看全部评分

用头画头像,用脚写脚本
回复 1 0

使用道具 举报

梦石
0
星屑
35258
在线时间
4171 小时
注册时间
2007-12-15
回帖
9490
发表于 2019-1-3 04:32:30 | 显示全部楼层
本帖最后由 89444640 于 2019-1-3 04:37 编辑

上下余裕那个你改成0试试,不过那样动起就没法做到蹭着前进了。除了没有最高点减速,本身手感还是不错的
你找的这个版本,有很多致命问题,比如,没有加开关控制,会造成行走图播放异常,重力脚本未执行时也会出现异动半格,于是就穿地图什么的各种显示异常,相信我,你遇到过的我都遇到过,毕竟我用这脚本无数年,就刚才这个bug害我改过无数遍图。
如果你非要用,我给你现在修改过的版本,但是由于跟我脚本在整合的非常瓷实,你必须进行大量修改才能用。具体改哪里我也不知道- -b
另外,对图像要比较多,还有音效,自己替换一下,
图像基础动作你需要准备两段跳的第一段和第二段,跳跃上升动作,下降动作,用并行处理的话,还可以做待机 走动 跑动。我这由于角色大跑动以后难以判断落点,于是就只有平地允许跑动了。平台跑动会影响操作。
由于现在整以前剧情没做到到这里,滑铲、下蹲躲避都还没加
总之,你试试可以,但是要记得,做act老老实实用actmaker去,这个就试一下直接走剧情看片还行,真的做不出太好效果。
脚本如下,反正我目前见到的毛病全修了一遍,没修的就是改不了的,你看人员名单就知道了。N个程序帮我改过
  1. # ————————————————————————————————————
  2. # 全方向ドット移動
  3. # 配布元・サポートURL
  4. # [url]http://members.jcom.home.ne.jp/cogwheel/[/url]
  5. # ————————————————————————————————————
  6. #版本编号 201812XX 增加了范围触发 切换场景更加方便了 以前改过什么……没按时间记录,忘了。
  7. # ————————————————————————————————————
  8. #$ud_ok = false #上下失效
  9. #$airjump = 1  #空中连跳
  10. #用全局变量开启重力脚本 $ud_ok = true/false
  11. #重力脚本控制开关为 GRAVITY_ENABLED = xx(开关编号)
  12. # ————————————————————————————————————
  13. #【排名不分先后】感谢 rpg_sheep、芯☆淡茹水、STILLIA、RyanBern 灯笼菜刀王 参与脚本的完善
  14. #soulsaga修正可执行待机跑动切换模式。
  15. #==============================================================================
  16. # ■ Game_Player
  17. #------------------------------------------------------------------------------
  18. #  プレイヤーを扱うクラスです。イベントの起動判定や、マップのスクロールなどの
  19. # 機能を持っています。このクラスのインスタンスは $game_player で参照されます。
  20. #==============================================================================
  21. class Game_Player < Game_Character
  22.   #--------------------------------------------------------------------------
  23.   # ● 定数
  24.   #--------------------------------------------------------------------------
  25.   UP    = 48                  # 上方 允余量(0 < UP < 63)
  26.   DOWN  = -5                  # 下方 允余量(0 < DOWN <63)
  27.   SIDE  = 32                  # 左右 允余量(0 < SIDE <63)
  28.   SLANT = false               # 斜向移动速度修正
  29.   JUMPMAX = 100               # 跳跃高度
  30.   JUMPADD = 10
  31.   GRAVITY_ENABLED = 212       # 重力脚本生效开关编号,打开为生效
  32.   AIRJUMP = 14                # 用14号变量开关控制跳跃次数,1为两段跳
  33.   #--------------------------------------------------------------------------
  34.   # ● 公開インスタンス変数
  35.   #--------------------------------------------------------------------------
  36.   attr_reader   :event                    # 事件时候移动速度
  37.   attr_accessor :move_speed               # 一般移动速度
  38.   #--------------------------------------------------------------------------
  39.   # ● フレーム更新
  40.   #--------------------------------------------------------------------------
  41.   alias :update_original :update
  42.   def update
  43.     @data_count -= 1 if @data_count and @data_count > 0
  44.     # @walk:歩行速度 @dash:ダッシュ時移動速度
  45.     # @event:イベント時移動速度(0の時は、イベント時に速度変更をしない)
  46.     @walk  = 4
  47.     @dash  = 5
  48.     @event = 4
  49.     @dot_m = $game_switches[GRAVITY_ENABLED]
  50.     #ダッシュ機能。エンターキーが押されている間、移動速度を変更する。
  51.      if !$game_switches[6] #6号开关打开,关闭空格键行走加速。
  52.     unless moving? or $game_system.map_interpreter.running? or
  53.             @move_route_forcing or $game_temp.message_window_showing
  54.       if @walk != @dash
  55.         if Input.press?(Input::C)
  56.           if @move_speed != @dash
  57.             @move_speed = @dash
  58.           end
  59.         else
  60.           if @move_speed != @walk
  61.             @move_speed = @walk
  62.           end
  63.         end
  64.       end
  65.     end
  66.     end
  67.     if @revise_x == nil and @revise_y == nil
  68.       @revise_x = 0
  69.       @revise_y = 0
  70.     end
  71.     unless @dot_m
  72.       update_original
  73.       return
  74.     end
  75.     f = @触范
  76.     if @move_route_forcing
  77.       # ローカル変数に移動中かどうかを記憶
  78.       last_moving = moving?
  79.       # ローカル変数に座標を記憶
  80.       last_real_x = @real_x
  81.       last_real_y = @real_y
  82.       # 座標がずれている場合
  83.       if (@revise_x != 0 or @revise_y != 0) and not jumping? and @move == true
  84.         if @revise_x != @real_x - @x * 128 or @revise_y != @real_y - @y * 128
  85.           @revise_x = @real_x - @x * 128
  86.           @revise_y = @real_y - @y * 128
  87.         end
  88.         # 移動距離distance1と目標距離distance2を設定
  89.         distance1 = 2 ** @move_speed
  90.         distance2 = Math.sqrt(@revise_x ** 2 + @revise_y ** 2)
  91.         # 移動距離が目標距離を越えた場合
  92.         if distance1 > distance2
  93.           # 強制的に補正座標を零にする
  94.           @real_x = @real_x - @revise_x
  95.           @real_y = @real_y - @revise_y
  96.           @revise_x = 0
  97.           @revise_y = 0
  98.           anime_update
  99.         # 移動距離が目標距離に達しない場合
  100.         else
  101.           # 移動距離分目標距離に近づく
  102.           @real_x -= (distance1 * @revise_x / distance2).round
  103.           @real_y -= (distance1 * @revise_y / distance2).round
  104.           @revise_x = @real_x - @x * 128
  105.           @revise_y = @real_y - @y * 128
  106.           anime_update
  107.         end
  108.       else
  109.         super
  110.       end
  111.     else
  112.       @move = false
  113.       # 移動中、イベント実行中、移動ルート強制中、
  114.       # メッセージウィンドウ表示中のいずれでもない場合
  115.       unless moving? or $game_system.map_interpreter.running? or
  116.              @move_route_forcing or $game_temp.message_window_showing or
  117.              $game_switches[NO_MOVE_NOW]
  118.         @event_run = false
  119.         # 方向ボタンが押されていれば、その方向へプレイヤーを移動
  120. #---------------------------上下失效-----------------------------------------
  121.       $game_switches[TAK_TYPE_UP] = false if TAK_TYPE_UP != 0
  122.       $game_switches[TAK_TYPE_DOWN] = false if TAK_TYPE_DOWN != 0
  123.       case Input.dir8
  124.         when 1
  125.           move_lower_left_p# : move_left_p
  126.           f = 范围触发
  127.         when 2
  128.           $game_switches[TAK_TYPE_DOWN] = true if TAK_TYPE_DOWN != 0 and !@apassed
  129. #          $ud_ok ? move_down_p : move_down_aaaagq
  130. #          move_down_p# if $ud_ok
  131.         when 3
  132.          move_lower_right_p# : move_right_p
  133.          f = 范围触发
  134.         when 4
  135.           move_left_p
  136.           f = 范围触发
  137.         when 6
  138.           move_right_p
  139.           f = 范围触发
  140.         when 7
  141.           move_upper_left_p# : move_left_p
  142.           f = 范围触发
  143.         when 8
  144.           $game_switches[TAK_TYPE_UP] = true if TAK_TYPE_UP != 0 and !@apassed
  145. #         $ud_ok ? move_up_p : move_up_aaaagq
  146. #          move_up_p# if $ud_ok
  147.         when 9
  148.          move_upper_right_p# : move_right_p
  149.          f = 范围触发
  150.         end
  151.       end
  152.       # ローカル変数に座標を記憶
  153.       last_real_x = @real_x
  154.       last_real_y = @real_y
  155.       # 移動処理
  156.       @real_x = @x * 128 + @revise_x
  157.       @real_y = @y * 128 + @revise_y
  158.       # ローカル変数に移動中かどうかを記憶
  159.       last_moving = moving?
  160.       # 座標更新
  161.       move_on
  162.       # 現在の座標と以前の座標が異なる場合
  163.       if (last_real_x != @real_x or last_real_y != @real_y)
  164.         @move_distance = 0 if @move_distance == nil
  165.         @move_distance += Math.sqrt((last_real_x - @real_x) ** 2 +
  166.                                       (last_real_y - @real_y) ** 2)
  167.         if @move_distance >= 128
  168.           @move_distance %= 128
  169.           increase_steps
  170.         end
  171.         # アニメーションを更新
  172.         anime_update
  173.       else
  174.         @pattern = 0
  175.       end
  176.     end
  177.     # キャラクターが下に移動し、かつ画面上の位置が中央より下の場合
  178.     if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  179.       # マップを下にスクロール
  180.       $game_map.scroll_down(@real_y - last_real_y)
  181.     end
  182.     # キャラクターが左に移動し、かつ画面上の位置が中央より左の場合
  183.     if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  184.       # マップを左にスクロール
  185.       $game_map.scroll_left(last_real_x - @real_x)
  186.     end
  187.     # キャラクターが右に移動し、かつ画面上の位置が中央より右の場合
  188.     if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  189.       # マップを右にスクロール
  190.       $game_map.scroll_right(@real_x - last_real_x)
  191.     end
  192.     # キャラクターが上に移動し、かつ画面上の位置が中央より上の場合
  193.     if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  194.       # マップを上にスクロール
  195.       $game_map.scroll_up(last_real_y - @real_y)
  196.     end
  197.     #-菜刀王到此一游----------------------------------------------
  198.     if @触范[0] != f[0] or (f[0] < 0 and @触范[1] != f[1])
  199.       if f[0] == 0
  200.         @触范 = f
  201.       else
  202.         event = $game_map.events[f[0].abs]
  203.         if event != nil and event.trigger == 1 and !event.jumping?
  204.           event.start
  205.           @触范 = f
  206.           return
  207.         end
  208.       end
  209.     end
  210.     #-------------------------------------------------------------
  211.     # 前回プレイヤーが移動中だった場合
  212.     if last_moving
  213.       # 同位置のイベントとの接触によるイベント起動判定
  214.       result = check_event_trigger_here([1,2])
  215.       if result == true
  216.         if (last_real_x / 128.0).round != @x and
  217.             (last_real_y / 128.0).round != @y
  218.           if @direction == 2 or @direction == 8
  219.             if (last_real_x / 128.0).round > @x
  220.               turn_left
  221.             else
  222.               turn_right
  223.             end
  224.           else
  225.             if (last_real_y / 128.0).round > @y
  226.               turn_up
  227.             else
  228.               turn_down
  229.             end
  230.           end
  231.         elsif (last_real_x / 128.0).round > @x
  232.           turn_left
  233.         elsif (last_real_x / 128.0).round < @x
  234.           turn_right
  235.         elsif (last_real_y / 128.0).round > @y
  236.           turn_up
  237.         elsif (last_real_y / 128.0).round < @y
  238.           turn_down
  239.         end
  240.       end
  241.       # 起動したイベントがない場合
  242.       if result == false
  243.         # デバッグモードが ON かつ CTRL キーが押されている場合を除き
  244.         unless $DEBUG and Input.press?(Input::CTRL)
  245.           # エンカウント カウントダウン
  246.           if @encounter_count > 0
  247.             @encounter_count -= 1
  248.           end
  249.         end
  250.       end
  251.     end
  252.     #-----------------------按跳跃-----------------------------------------------
  253.     # A ボタンが押された場合
  254.     if Input.press?(Input::A)# and not $ud_ok
  255.       @twojump = 1 if @twojump == 0 and down1(((@x * 128 + @revise_x) / 128.0).round,
  256.       ((@y * 128 + @revise_y) / 128.0).round, 5, true)
  257.       if (not @apassed) and @twojump <= $game_variables[AIRJUMP]
  258.         @apassed = true
  259.         @jumpnow = JUMPMAX
  260.         se_name = @twojump == 1 ? "ACT 跳02.ogg" : "ACT 跳01.ogg"
  261.         Audio.se_play("Audio/SE/#{se_name}")
  262.         @twojump += 1
  263.       else
  264.         @jumpnow += 3        
  265.       end
  266.     else
  267.       @apassed = false
  268.     end
  269.     #----------------------自由落体--------------------------------
  270.     #if not $ud_ok
  271.       @jumpnow -= 10
  272.       if @jumpnow < 0
  273.         $game_variables[3] = @jumpnow
  274.         $game_switches[1] = true
  275.         @character_name = "主角ACT12下落" if $game_switches[3] != true
  276.         @jumpnow = [@jumpnow, -JUMPMAX].max
  277.         if not down1(((@x * 128 + @revise_x) / 128.0).round,
  278.           ((@y * 128 + @revise_y) / 128.0).round, -@jumpnow, true)
  279.           @jumpnow = 0
  280.           @twojump = 0
  281.           @character_name = "主角 行走 长袖" if $game_switches[3] != true
  282.           $game_switches[3] = false
  283.         end
  284.       elsif @jumpnow > 0
  285.         @character_name = @twojump == 1 ? "主角 ACT用跳跃" : "主角ACT11两段跳"
  286.         @jumpnow = [@jumpnow, JUMPMAX].min
  287.         if not up1(((@x * 128 + @revise_x) / 128.0).round,
  288.           ((@y * 128 + @revise_y) / 128.0).round, @jumpnow, true)
  289.           @jumpnow = 0
  290.         end
  291.       end
  292.     #end
  293.     if @data_name != @character_name
  294.       @data_name = @character_name
  295.       Audio.se_play("Audio/SE/ACT 落地.ogg") if @character_name == "主角 行走 长袖"
  296.     end
  297.     if Input.trigger?(Input::C)
  298.       # 同位置および正面のイベント起動判定
  299.       check_event_trigger_here([0])
  300.       check_event_trigger_there([0,1,2])
  301.     end
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ● オブジェクト初期化
  305.   #--------------------------------------------------------------------------
  306.   def initialize
  307.     @jumpnow = 0
  308.     @twojump = 0
  309.     @apassed = false
  310.     @revise_x = 0
  311.     @revise_y = 0
  312.     @move == false
  313.     @触范 = [0]
  314.     super
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● 移動判定
  318.   #--------------------------------------------------------------------------
  319.   def moving?
  320.     unless @dot_m
  321.       result = super
  322.       return result
  323.     end
  324.     # 強制移動の場合オリジナルの判定をさせる
  325.     if @move_route_forcing
  326.       if @move == false
  327.         return false
  328.       end
  329.       super
  330.     # 通常時は現座標が実座標と異なる場合のみ移動中と判定
  331.     else
  332.       return (@x != (@real_x / 128.0).round or @y != (@real_y / 128.0).round)
  333.     end
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ● 移動判定
  337.   #--------------------------------------------------------------------------
  338.   def moving_a?
  339.     if @move == false
  340.       if (@move_route.list[@move_route_index].code <= 14 or
  341.           @move_route.list[@move_route_index].code == 25)
  342.         @move = true
  343.       end
  344.       return false
  345.     end
  346.     moving?
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● フレーム更新 (ジャンプ)
  350.   #--------------------------------------------------------------------------
  351.   def update_jump
  352.     # ジャンプカウントを 1 減らす
  353.     @jump_count -= 1
  354.     # 新しい座標を計算
  355.     @real_x = (@real_x * @jump_count + @x * 128) / (@jump_count + 1)
  356.     @real_y = (@real_y * @jump_count + @y * 128) / (@jump_count + 1)
  357.     if @jump_count == 0
  358.       @revise_x = 0
  359.       @revise_y = 0
  360.     end
  361.   end
  362.   #--------------------------------------------------------------------------
  363.   # ● 移動タイプ : カスタム
  364.   #--------------------------------------------------------------------------
  365.   def move_type_custom
  366.     unless @dot_m
  367.       super
  368.       return
  369.     end
  370.     # 停止中でなければ中断
  371.     if jumping? or moving_a?
  372.       return
  373.     end
  374.     # 移動コマンドのリストの最後に到達するまでループ
  375.     while @move_route_index < @move_route.list.size
  376.       # 移動コマンドを取得
  377.       command = @move_route.list[@move_route_index]
  378.       # コマンドコード 0 番 (リストの最後) の場合
  379.       if command.code == 0
  380.         # オプション [動作を繰り返す] が ON の場合
  381.         if @move_route.repeat
  382.           # 移動ルートのインデックスを最初に戻す
  383.           @move_route_index = 0
  384.         end
  385.         # オプション [動作を繰り返す] が OFF の場合
  386.         unless @move_route.repeat
  387.           # 移動ルート強制中の場合
  388.           if @move_route_forcing and not @move_route.repeat
  389.             # 移動ルートの強制を解除
  390.             @move_route_forcing = false
  391.             # オリジナルの移動ルートを復帰
  392.             @move_route = @original_move_route
  393.             @move_route_index = @original_move_route_index
  394.             @original_move_route = nil
  395.           end
  396.           # 停止カウントをクリア
  397.           @stop_count = 0
  398.         end
  399.         return
  400.       end
  401.       # 移動系コマンド (下に移動~ジャンプ) の場合
  402.       if command.code <= 14
  403.         # コマンドコードで分岐
  404.         case command.code
  405.         when 1  # 下に移動
  406.           move_down
  407.         when 2  # 左に移動
  408.           move_left
  409.         when 3  # 右に移動
  410.           move_right
  411.         when 4  # 上に移動
  412.           move_up
  413.         when 5  # 左下に移動
  414.           move_lower_left
  415.         when 6  # 右下に移動
  416.           move_lower_right
  417.         when 7  # 左上に移動
  418.           move_upper_left
  419.         when 8  # 右上に移動
  420.           move_upper_right
  421.         when 9  # ランダムに移動
  422.           move_random
  423.         when 10  # プレイヤーに近づく
  424.           move_toward_player
  425.         when 11  # プレイヤーから遠ざかる
  426.           move_away_from_player
  427.         when 12  # 一歩前進
  428.           move_forward
  429.         when 13  # 一歩後退
  430.           move_backward
  431.         when 14  # ジャンプ
  432.           jump(command.parameters[0], command.parameters[1])
  433.         end
  434.         # オプション [移動できない場合は無視] が OFF で、移動失敗の場合
  435.         if not @move_route.skippable and not moving? and not jumping?
  436.           return
  437.         end
  438.         @move_route_index += 1
  439.         return
  440.       end
  441.       # ウェイトの場合
  442.       if command.code == 15
  443.         # ウェイトカウントを設定
  444.         @wait_count = command.parameters[0] * 2 - 1
  445.         @move_route_index += 1
  446.         return
  447.       end
  448.       # 向き変更系のコマンドの場合
  449.       if command.code >= 16 and command.code <= 26
  450.         # コマンドコードで分岐
  451.         case command.code
  452.         when 16  # 下を向く
  453.           turn_down
  454.         when 17  # 左を向く
  455.           turn_left
  456.         when 18  # 右を向く
  457.           turn_right
  458.         when 19  # 上を向く
  459.           turn_up
  460.         when 20  # 右に 90 度回転
  461.           turn_right_90
  462.         when 21  # 左に 90 度回転
  463.           turn_left_90
  464.         when 22  # 180 度回転
  465.           turn_180
  466.         when 23  # 右か左に 90 度回転
  467.           turn_right_or_left_90
  468.         when 24  # ランダムに方向転換
  469.           turn_random
  470.         when 25  # プレイヤーの方を向く
  471.           turn_toward_player
  472.         when 26  # プレイヤーの逆を向く
  473.           turn_away_from_player
  474.         end
  475.         @move_route_index += 1
  476.         return
  477.       end
  478.       # その他のコマンドの場合
  479.       if command.code >= 27
  480.         # コマンドコードで分岐
  481.         case command.code
  482.         when 27  # スイッチ ON
  483.           $game_switches[command.parameters[0]] = true
  484.           $game_map.need_refresh = true
  485.         when 28  # スイッチ OFF
  486.           $game_switches[command.parameters[0]] = false
  487.           $game_map.need_refresh = true
  488.         when 29  # 移動速度の変更
  489.           @move_speed = command.parameters[0]
  490.         when 30  # 移動頻度の変更
  491.           @move_frequency = command.parameters[0]
  492.         when 31  # 移動時アニメ ON
  493.           @walk_anime = true
  494.         when 32  # 移動時アニメ OFF
  495.           @walk_anime = false
  496.         when 33  # 停止時アニメ ON
  497.           @step_anime = true
  498.         when 34  # 停止時アニメ OFF
  499.           @step_anime = false
  500.         when 35  # 向き固定 ON
  501.           @direction_fix = true
  502.         when 36  # 向き固定 OFF
  503.           @direction_fix = false
  504.         when 37  # すり抜け ON
  505.           @through = true
  506.         when 38  # すり抜け OFF
  507.           @through = false
  508.         when 39  # 最前面に表示 ON
  509.           @always_on_top = true
  510.         when 40  # 最前面に表示 OFF
  511.           @always_on_top = false
  512.         when 41  # グラフィック変更
  513.           @tile_id = 0
  514.           @character_name = command.parameters[0]
  515.           @character_hue = command.parameters[1]
  516.           if @original_direction != command.parameters[2]
  517.             @direction = command.parameters[2]
  518.             @original_direction = @direction
  519.             @prelock_direction = 0
  520.           end
  521.           if @original_pattern != command.parameters[3]
  522.             @pattern = command.parameters[3]
  523.             @original_pattern = @pattern
  524.           end
  525.         when 42  # 不透明度の変更
  526.           @opacity = command.parameters[0]
  527.         when 43  # 合成方法の変更
  528.           @blend_type = command.parameters[0]
  529.         when 44  # SE の演奏
  530.           $game_system.se_play(command.parameters[0])
  531.         when 45  # スクリプト
  532.           result = eval(command.parameters[0])
  533.         end
  534.         @move_route_index += 1
  535.         return
  536.       end
  537.     end
  538.   end
  539.   #--------------------------------------------------------------------------
  540.   # ● 下に移動
  541.   #--------------------------------------------------------------------------
  542.   def move_down_p
  543.     # 下を向く
  544.     turn_down
  545.     # 移動距離を算出
  546.     distance = 2 ** @move_speed
  547.     down1(((@x * 128 + @revise_x) / 128.0).round,
  548.           ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  549.   end
  550.   def move_down_aaaagq
  551.     distance = 2 ** @move_speed
  552.     down1(((@x * 128 + @revise_x) / 128.0).round,
  553.           ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # ● 下に移動可能かどうかの判定1
  557.   #--------------------------------------------------------------------------
  558.   def down1(x, y, distance, down = false)
  559.     result = down2(x, y, distance)
  560.     if result == false
  561.       @event_run = check_event_trigger_touch(x, y+1)
  562.       return result
  563.     end
  564.     if @revise_x < -SIDE
  565.       result = down2(x, y + 1, distance, 4)
  566.       result &= down2(x - 1, y, distance)
  567.       if result == false
  568.         if down
  569.           move_lower_right_p
  570.           if @revise_x > SIDE
  571.             @revise_x = SIDE
  572.           end
  573.         end
  574.         return result
  575.       end
  576.     elsif @revise_x > SIDE
  577.       result = down2(x, y + 1, distance, 6)
  578.       result &= down2(x + 1, y, distance)
  579.       if result == false
  580.         if down
  581.           move_lower_left_p
  582.           if @revise_x < -SIDE
  583.             @revise_x = -SIDE
  584.           end
  585.         end
  586.         return result
  587.       end
  588.     end
  589.     # 下に移動可能ならば距離分移動
  590.     @revise_y += distance
  591.     return result
  592.   end
  593.   #--------------------------------------------------------------------------
  594.   # ● 下に移動可能かどうかの判定2
  595.   #--------------------------------------------------------------------------
  596.   def down2(x, y, distance, d = 2)
  597.     if @revise_y + distance > DOWN
  598.       unless passable?(x, y, d)
  599.         if @revise_y < DOWN
  600.           @revise_y = DOWN
  601.         end
  602.         return false
  603.       end
  604.     end
  605.     return true
  606.   end
  607.   #--------------------------------------------------------------------------
  608.   # ● 左に移動
  609.   #--------------------------------------------------------------------------
  610.   def move_left_p
  611.     # 左を向く
  612.     turn_left
  613.     distance = 2 ** @move_speed
  614.     left1(((@x * 128 + @revise_x) / 128.0).round,
  615.           ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  616.   end
  617.   #--------------------------------------------------------------------------
  618.   # ● 左に移動可能かどうかの判定1
  619.   #--------------------------------------------------------------------------
  620.   def left1(x, y, distance, left = false)
  621.     result = left2(x, y, distance)
  622.     if result == false
  623.       @event_run = check_event_trigger_touch(x-1, y)
  624.       return result
  625.     end
  626.     if @revise_y < -UP and $ud_ok
  627.       result = left2(x - 1, y, distance, 8)
  628.       result &= left2(x, y - 1, distance)
  629.       if result == false
  630.         if left
  631.           move_lower_left_p
  632.           if @revise_y > DOWN
  633.             @revise_y = DOWN
  634.           end
  635.         end
  636.         return result
  637.       end
  638.     elsif @revise_y > DOWN and $ud_ok
  639.       result = left2(x - 1, y, distance, 2)
  640.       result &= left2(x, y + 1, distance)
  641.       if result == false
  642.         if left
  643.           move_upper_left_p
  644.           if @revise_y < -UP
  645.             @revise_y = -UP
  646.           end
  647.         end
  648.         return result
  649.       end
  650.     end
  651.     @revise_x -= distance
  652.     return result
  653.   end
  654.   #--------------------------------------------------------------------------
  655.   # ● 左に移動可能かどうかの判定2
  656.   #--------------------------------------------------------------------------
  657.   def left2(x, y, distance, d = 4)
  658.     if @revise_x - distance < -SIDE
  659.       unless passable?(x, y, d)
  660.         if @revise_x > -SIDE
  661.           @revise_x = -SIDE
  662.         end
  663.         return false
  664.       end
  665.     end
  666.     return true
  667.   end
  668.   #--------------------------------------------------------------------------
  669.   # ● 右に移動
  670.   #--------------------------------------------------------------------------
  671.   def move_right_p
  672.       # 右を向く
  673.       turn_right
  674.     distance = 2 ** @move_speed
  675.     right1(((@x * 128 + @revise_x) / 128.0).round,
  676.             ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  677.   end
  678.   #--------------------------------------------------------------------------
  679.   # ● 右に移動可能かどうかの判定1
  680.   #--------------------------------------------------------------------------
  681.   def right1(x, y, distance, right = false)
  682.     result = right2(x, y, distance)
  683.     if result == false
  684.       @event_run = check_event_trigger_touch(x+1, y)
  685.       return result
  686.     end
  687.     if @revise_y < -UP and $ud_ok
  688.       result = right2(x + 1, y, distance, 8)
  689.       result &= right2(x, y - 1, distance)
  690.       if result == false
  691.         if right
  692.           move_lower_right_p
  693.           if @revise_y > DOWN
  694.             @revise_y = DOWN
  695.           end
  696.         end
  697.         return result
  698.       end
  699.     elsif @revise_y > DOWN and $ud_ok
  700.       result = right2(x + 1, y, distance, 2)
  701.       result &= right2(x, y + 1, distance)
  702.       if result == false
  703.         if right
  704.           move_upper_right_p
  705.           if @revise_y < -UP
  706.             @revise_y = -UP
  707.           end
  708.         end
  709.         return result
  710.       end
  711.     end
  712.     @revise_x += distance
  713.     return result
  714.   end
  715.   #--------------------------------------------------------------------------
  716.   # ● 右に移動可能かどうかの判定2
  717.   #--------------------------------------------------------------------------
  718.   def right2(x, y, distance, d = 6)
  719.     if @revise_x + distance > SIDE
  720.       unless passable?(x, y, d)
  721.         if @revise_x < SIDE
  722.           @revise_x = SIDE
  723.         end
  724.         return false
  725.       end
  726.     end
  727.     return true
  728.   end
  729.   #--------------------------------------------------------------------------
  730.   # ● 上に移動
  731.   #--------------------------------------------------------------------------
  732.   def move_up_p
  733.     # 上を向く
  734.     turn_up
  735.     # 下に移動
  736.     distance = 2 ** @move_speed
  737.     up1(((@x * 128 + @revise_x) / 128.0).round,
  738.         ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  739.   end
  740.   def move_up_aaaagq
  741.     distance = 2 ** @move_speed
  742.     up1(((@x * 128 + @revise_x) / 128.0).round,
  743.         ((@y * 128 + @revise_y) / 128.0).round, distance, true)
  744.   end
  745.   #--------------------------------------------------------------------------
  746.   # ● 上に移動可能かどうかの判定1
  747.   #--------------------------------------------------------------------------
  748.   def up1(x, y, distance, up = false)
  749.     result = up2(x, y, distance)
  750.     if result == false
  751.       @event_run = check_event_trigger_touch(x, y-1)
  752.       return result
  753.     end
  754.     if @revise_x < -SIDE
  755.       result = up2(x, y - 1, distance, 4)
  756.       result &= up2(x - 1, y, distance)
  757.       if result == false
  758.         if up
  759.           move_upper_right_p
  760.           if @revise_x > SIDE
  761.             @revise_x = SIDE
  762.           end
  763.         end
  764.         return result
  765.       end
  766.     elsif @revise_x > SIDE
  767.       result = up2(x, y - 1, distance, 6)
  768.       result &= up2(x + 1, y, distance)
  769.       if result == false
  770.         if up
  771.           move_upper_left_p
  772.           if @revise_x < -SIDE
  773.             @revise_x = -SIDE
  774.           end
  775.         end
  776.         return result
  777.       end
  778.     end
  779.     @revise_y -= distance
  780.     return result
  781.   end
  782.   #--------------------------------------------------------------------------
  783.   # ● 上に移動可能かどうかの判定2
  784.   #--------------------------------------------------------------------------
  785.   def up2(x, y, distance, d = 8)
  786.     if @revise_y - distance < -UP
  787.       unless passable?(x, y, d)
  788.         if @revise_y > -UP
  789.           @revise_y = -UP
  790.         end
  791.         return false
  792.       end
  793.     end
  794.     return true
  795.   end
  796.   #--------------------------------------------------------------------------
  797.   # ● 左下に移動
  798.   #--------------------------------------------------------------------------
  799.   def move_lower_left_p
  800.     # 向き固定でない場合
  801.     unless @direction_fix
  802.       # 右向きだった場合は左を、上向きだった場合は下を向く
  803.       @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
  804.     end
  805.     # 左下に移動
  806.     distance = (2 ** @move_speed) / Math.sqrt(2)
  807.     if @direction == 2
  808.       turn_left unless down1(((@x * 128 + @revise_x) / 128.0).round,
  809.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  810.       turn_down if @event_run
  811.       unless @event_run
  812.         if last_move?(@real_x, @real_y, 2, distance)
  813.           result = check_event_trigger_here([1,2], false)
  814.           if result == true
  815.             return
  816.           end
  817.         end
  818.         move_on
  819.         if @revise_y > DOWN and -UP > @revise_y - distance
  820.           @revise_y = DOWN
  821.         end
  822.         turn_down unless left1(((@x * 128 + @revise_x) / 128.0).round,
  823.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  824.         turn_left if @event_run
  825.       end
  826.     else
  827.       turn_down unless left1(((@x * 128 + @revise_x) / 128.0).round,
  828.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  829.       turn_left if @event_run
  830.       unless @event_run
  831.         if last_move?(@real_x, @real_y, 4, distance)
  832.           result = check_event_trigger_here([1,2], false)
  833.           if result == true
  834.             return
  835.           end
  836.         end
  837.         move_on
  838.         if  @revise_x + distance> SIDE and -SIDE > @revise_x
  839.           @revise_x = -SIDE
  840.         end
  841.         turn_left unless down1(((@x * 128 + @revise_x) / 128.0).round,
  842.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  843.         turn_down if @event_run
  844.       end
  845.     end
  846.   end
  847.   #--------------------------------------------------------------------------
  848.   # ● 右下に移動
  849.   #--------------------------------------------------------------------------
  850.   def move_lower_right_p
  851.     # 向き固定でない場合
  852.     unless @direction_fix
  853.       # 左向きだった場合は右を、上向きだった場合は下を向く
  854.       @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
  855.     end
  856.     # 右下に移動
  857.     distance = (2 ** @move_speed) / Math.sqrt(2)
  858.     if @direction == 2
  859.       turn_right unless down1(((@x * 128 + @revise_x) / 128.0).round,
  860.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  861.       turn_down if @event_run
  862.       unless @event_run
  863.         if last_move?(@real_x, @real_y, 2, distance)
  864.           result = check_event_trigger_here([1,2], false)
  865.           if result == true
  866.             return
  867.           end
  868.         end
  869.         move_on
  870.         if @revise_y > DOWN and -UP > @revise_y - distance
  871.           @revise_y = DOWN
  872.         end
  873.         turn_down unless right1(((@x * 128 + @revise_x) / 128.0).round,
  874.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  875.         turn_right if @event_run
  876.       end
  877.     else
  878.       turn_down unless right1(((@x * 128 + @revise_x) / 128.0).round,
  879.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  880.       turn_right if @event_run
  881.       unless @event_run
  882.         if last_move?(@real_x, @real_y, 6, distance)
  883.           result = check_event_trigger_here([1,2], false)
  884.           if result == true
  885.             return
  886.           end
  887.         end
  888.         move_on
  889.         if @revise_x > SIDE and -SIDE > @revise_x - distance
  890.           @revise_x = SIDE
  891.         end
  892.         turn_right unless down1(((@x * 128 + @revise_x) / 128.0).round,
  893.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  894.         turn_down if @event_run
  895.       end
  896.     end
  897.   end
  898.   #--------------------------------------------------------------------------
  899.   # ● 左上に移動
  900.   #--------------------------------------------------------------------------
  901.   def move_upper_left_p
  902.     # 向き固定でない場合
  903.     unless @direction_fix
  904.       # 右向きだった場合は左を、下向きだった場合は上を向く
  905.       @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
  906.     end
  907.     # 左上に移動
  908.     distance = (2 ** @move_speed) / Math.sqrt(2)
  909.     if @direction == 8
  910.       turn_left unless up1(((@x * 128 + @revise_x) / 128.0).round,
  911.                             ((@y * 128 + @revise_y) / 128.0).round, distance)
  912.       turn_up if @event_run
  913.       unless @event_run
  914.         if last_move?(@real_x, @real_y, 8, distance)
  915.           result = check_event_trigger_here([1,2], false)
  916.           if result == true
  917.             return
  918.           end
  919.         end
  920.         move_on
  921.         if @revise_y + distance > DOWN and -UP > @revise_y
  922.           @revise_y = -UP
  923.         end
  924.         turn_up unless left1(((@x * 128 + @revise_x) / 128.0).round,
  925.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  926.         turn_left if @event_run
  927.       end
  928.     else
  929.       turn_up unless left1(((@x * 128 + @revise_x) / 128.0).round,
  930.                             ((@y * 128 + @revise_y) / 128.0).round, distance)
  931.       turn_left if @event_run
  932.       unless @event_run
  933.         if last_move?(@real_x, @real_y, 4, distance)
  934.           result = check_event_trigger_here([1,2], false)
  935.           if result == true
  936.             return
  937.           end
  938.         end
  939.         move_on
  940.         if @revise_x > SIDE and -SIDE > @revise_x - distance
  941.           @revise_x = SIDE
  942.         end
  943.         turn_left unless up1(((@x * 128 + @revise_x) / 128.0).round,
  944.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  945.         turn_up if @event_run
  946.       end
  947.     end
  948.   end
  949.   #--------------------------------------------------------------------------
  950.   # ● 右上に移動
  951.   #--------------------------------------------------------------------------
  952.   def move_upper_right_p
  953.     # 向き固定でない場合
  954.     unless @direction_fix
  955.       # 左向きだった場合は右を、下向きだった場合は上を向く
  956.       @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
  957.     end
  958.     # 右上に移動
  959.     distance = (2 ** @move_speed) / Math.sqrt(2)
  960.     if @direction == 8
  961.       turn_right unless up1(((@x * 128 + @revise_x) / 128.0).round,
  962.                             ((@y * 128 + @revise_y) / 128.0).round, distance)
  963.       turn_up if @event_run
  964.       unless @event_run
  965.         if last_move?(@real_x, @real_y, 8, distance)
  966.           result = check_event_trigger_here([1,2], false)
  967.           if result == true
  968.             return
  969.           end
  970.         end
  971.         move_on
  972.         if @revise_y + distance > DOWN and -UP > @revise_y
  973.           @revise_y = -UP
  974.         end
  975.         turn_up unless right1(((@x * 128 + @revise_x) / 128.0).round,
  976.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  977.         turn_right if @event_run
  978.       end
  979.     else
  980.       turn_up unless right1(((@x * 128 + @revise_x) / 128.0).round,
  981.                             ((@y * 128 + @revise_y) / 128.0).round, distance)
  982.       turn_right if @event_run
  983.       unless @event_run
  984.         if last_move?(@real_x, @real_y, 6, distance)
  985.           result = check_event_trigger_here([1,2], false)
  986.           if result == true
  987.             return
  988.           end
  989.         end
  990.         move_on
  991.         if @revise_x > SIDE and -SIDE > @revise_x - distance
  992.           @revise_x = SIDE
  993.         end
  994.         turn_right unless up1(((@x * 128 + @revise_x) / 128.0).round,
  995.                               ((@y * 128 + @revise_y) / 128.0).round, distance)
  996.         turn_up if @event_run
  997.       end
  998.     end
  999.   end
  1000.   #--------------------------------------------------------------------------
  1001.   # ● 同位置のイベント起動判定
  1002.   #--------------------------------------------------------------------------
  1003.   def check_event_trigger_here(triggers, run = true)
  1004.     result = false
  1005.     # イベント実行中の場合
  1006.     if $game_system.map_interpreter.running?
  1007.       return result
  1008.     end
  1009.     # 全イベントのループ
  1010.     for event in $game_map.events.values
  1011.       # イベントの座標とトリガーが一致した場合
  1012.       if event.x == ((@x * 128 + @revise_x) / 128.0).round and
  1013.           event.y == ((@y * 128 + @revise_y) / 128.0).round and
  1014.           triggers.include?(event.trigger)
  1015.         # ジャンプ中以外で、起動判定が同位置のイベントなら
  1016.         if not event.jumping? and event.over_trigger?
  1017.           if event.list.size > 1
  1018.             if run == true
  1019.               event.start
  1020.             end
  1021.             result = true
  1022.           end
  1023.         end
  1024.       end
  1025.     end
  1026.     return result
  1027.   end
  1028.   #--------------------------------------------------------------------------
  1029.   # ● 座標修正
  1030.   #--------------------------------------------------------------------------
  1031.   def move_on
  1032.     if @y < (@y + @revise_y / 128.0).round
  1033.       @y += 1
  1034.       @revise_y -= 128
  1035.     end
  1036.     if @x > (@x + @revise_x / 128.0).round
  1037.       @x -= 1
  1038.       @revise_x += 128
  1039.     end
  1040.     if @x < (@x + @revise_x / 128.0).round
  1041.       @x += 1
  1042.       @revise_x -= 128
  1043.     end
  1044.     if @y > (@y + @revise_y / 128.0).round
  1045.       @y -= 1
  1046.       @revise_y += 128
  1047.     end
  1048.   end
  1049.   #--------------------------------------------------------------------------
  1050.   # ● アニメーションアップデート
  1051.   #--------------------------------------------------------------------------
  1052.   def anime_update
  1053.     # 移動時アニメが ON の場合
  1054.     if @walk_anime
  1055.       # アニメカウントを 1.5 増やす
  1056.       @anime_count += 1.5
  1057.     # 移動時アニメが OFF で、停止時アニメが ON の場合
  1058.     elsif @step_anime
  1059.       # アニメカウントを 1 増やす
  1060.       @anime_count += 1
  1061.     end
  1062.     # アニメカウントが最大値を超えた場合
  1063.     # ※最大値は、基本値 18 から移動速度 * 1 を引いた値
  1064.     if @anime_count > 18 - @move_speed * 2
  1065.       # 停止時アニメが OFF かつ 停止中の場合
  1066.       if not @step_anime and @stop_count > 0
  1067.         # パターンをオリジナルに戻す
  1068.         @pattern = @original_pattern
  1069.       # 停止時アニメが ON または 移動中の場合
  1070.       else
  1071.         # パターンを更新
  1072.         @pattern = (@pattern + 1) % 4
  1073.       end
  1074.       # アニメカウントをクリア
  1075.       @anime_count = 0
  1076.     end
  1077.   end
  1078.   #--------------------------------------------------------------------------
  1079.   # ● 指定位置に移動
  1080.   #--------------------------------------------------------------------------
  1081.   # オリジナルのイベントを改名
  1082.   alias :moveto_original :moveto
  1083.   def moveto(x, y)
  1084.     # 補正座標を初期化
  1085.     @revise_x = 0
  1086.     @revise_y = 0
  1087.     # オリジナルのイベントを呼び出し
  1088.     moveto_original(x, y)
  1089.   end
  1090.   #--------------------------------------------------------------------------
  1091.   # ● 移動したかどうかの判定
  1092.   #--------------------------------------------------------------------------
  1093.   def last_move?(x, y, direction, distance)
  1094.     if direction == 2 or direction == 6
  1095.       distance *= -1
  1096.     end
  1097.     if (direction == 2 or direction == 8) and
  1098.         (y / 128.0).round != ((y - distance) / 128.0).round
  1099.       return true
  1100.     end
  1101.     if (direction == 4 or direction == 6) and
  1102.         (x / 128.0).round != ((x - distance) / 128.0).round
  1103.       return true
  1104.     end
  1105.     return false
  1106.   end

  1107. #==============================================================================
  1108. # ■ Game_Character (分割定義 1)
  1109. #------------------------------------------------------------------------------
  1110. #  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
  1111. # クラスのスーパークラスとして使用されます。
  1112. #==============================================================================

  1113. class Game_Character
  1114.   #--------------------------------------------------------------------------
  1115.   # ● フレーム更新 (移動)
  1116.   #--------------------------------------------------------------------------
  1117.   def update_move
  1118.     # 移動速度からマップ座標系での移動距離に変換
  1119.     distance = 2 ** @move_speed
  1120.     if @x * 128 != @real_x and @y * 128 != @real_y and Game_Player::SLANT
  1121.       distance /= Math.sqrt(2)
  1122.     end
  1123.     # 論理座標が実座標より下の場合
  1124.     if @y * 128 > @real_y
  1125.       # 下に移動
  1126.       @real_y = [@real_y + distance, @y * 128].min
  1127.     end
  1128.     # 論理座標が実座標より左の場合
  1129.     if @x * 128 < @real_x
  1130.       # 左に移動
  1131.       @real_x = [@real_x - distance, @x * 128].max
  1132.     end
  1133.     # 論理座標が実座標より右の場合
  1134.     if @x * 128 > @real_x
  1135.       # 右に移動
  1136.       @real_x = [@real_x + distance, @x * 128].min
  1137.     end
  1138.     # 論理座標が実座標より上の場合
  1139.     if @y * 128 < @real_y
  1140.       # 上に移動
  1141.       @real_y = [@real_y - distance, @y * 128].max
  1142.     end
  1143.     # 移動時アニメが ON の場合
  1144.     if @walk_anime
  1145.       # アニメカウントを 1.5 増やす
  1146.       @anime_count += 1.5
  1147.     # 移動時アニメが OFF で、停止時アニメが ON の場合
  1148.     elsif @step_anime
  1149.       # アニメカウントを 1 増やす
  1150.       @anime_count += 1
  1151.     end
  1152.   end
  1153. end

  1154. #==============================================================================
  1155. # ■ Game_Event
  1156. #------------------------------------------------------------------------------
  1157. #  イベントを扱うクラスです。条件判定によるイベントページ切り替えや、並列処理
  1158. # イベント実行などの機能を持っており、Game_Map クラスの内部で使用されます。
  1159. #==============================================================================
  1160. class Game_Event < Game_Character
  1161.   #--------------------------------------------------------------------------
  1162.   # ● イベント起動
  1163.   #--------------------------------------------------------------------------
  1164.   def start
  1165.     # 実行内容が空でない場合
  1166.     if @list.size > 1
  1167.       # $game_player.event が0でない場合
  1168.       if $game_player.event != 0
  1169.         # 移動速度を $game_player.event にする
  1170.         $game_player.move_speed = $game_player.event
  1171.       end
  1172.       @starting = true
  1173.     end
  1174.   end
  1175. end
  1176. end
复制代码

点评

我遇到的问题也是重力未执行的时候穿半格,导致地图异常,所以才想着把这些重力以外的都去掉  发表于 2019-1-3 14:01
谢谢回复!我这个就是一个剧情里的小游戏,我试一下  发表于 2019-1-3 13:57

评分

参与人数 1赞 +1 收起 理由
番茄幽灵 + 1 塞糖

查看全部评分

回复

使用道具 举报

梦石
3
星屑
1640
在线时间
198 小时
注册时间
2018-7-10
回帖
299
 楼主| 发表于 2019-1-9 21:19:36 | 显示全部楼层
我发现这个脚本还有很多其他bug,感觉太麻烦了不想改了,感谢各位的帮助
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部