设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2415|回复: 10
打印 上一主题 下一主题

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

[复制链接]

Lv3.寻梦者

梦石
3
星屑
1612
在线时间
196 小时
注册时间
2018-7-10
帖子
315
跳转到指定楼层
1
发表于 2019-1-2 15:04:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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

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

点评

这脚本留着原始的那个 配布元・サポートURL就行了,那个是原作者,其他的都是修改的版本。  发表于 2019-1-3 04:39

Lv3.寻梦者

梦石
3
星屑
1612
在线时间
196 小时
注册时间
2018-7-10
帖子
315
2
 楼主| 发表于 2019-1-2 15:56:53 | 只看该作者
或者有人能告诉我自己写的思路也行!跪求
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
10
星屑
39440
在线时间
1914 小时
注册时间
2010-11-14
帖子
3315

R考场第七期纪念奖

3
发表于 2019-1-2 18:47:55 | 只看该作者
本帖最后由 KB.Driver 于 2019-1-2 18:50 编辑

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

没法跑就随便说一句吧,从355行开始,
RUBY 代码复制
  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

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
34870
在线时间
4148 小时
注册时间
2007-12-15
帖子
9981
4
发表于 2019-1-3 04:32:30 | 只看该作者
本帖最后由 89444640 于 2019-1-3 04:37 编辑

上下余裕那个你改成0试试,不过那样动起就没法做到蹭着前进了。除了没有最高点减速,本身手感还是不错的
你找的这个版本,有很多致命问题,比如,没有加开关控制,会造成行走图播放异常,重力脚本未执行时也会出现异动半格,于是就穿地图什么的各种显示异常,相信我,你遇到过的我都遇到过,毕竟我用这脚本无数年,就刚才这个bug害我改过无数遍图。
如果你非要用,我给你现在修改过的版本,但是由于跟我脚本在整合的非常瓷实,你必须进行大量修改才能用。具体改哪里我也不知道- -b
另外,对图像要比较多,还有音效,自己替换一下,
图像基础动作你需要准备两段跳的第一段和第二段,跳跃上升动作,下降动作,用并行处理的话,还可以做待机 走动 跑动。我这由于角色大跑动以后难以判断落点,于是就只有平地允许跑动了。平台跑动会影响操作。
由于现在整以前剧情没做到到这里,滑铲、下蹲躲避都还没加
总之,你试试可以,但是要记得,做act老老实实用actmaker去,这个就试一下直接走剧情看片还行,真的做不出太好效果。
脚本如下,反正我目前见到的毛病全修了一遍,没修的就是改不了的,你看人员名单就知道了。N个程序帮我改过
RUBY 代码复制
  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. #==============================================================================
  1109. # ■ Game_Character (分割定義 1)
  1110. #------------------------------------------------------------------------------
  1111. #  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
  1112. # クラスのスーパークラスとして使用されます。
  1113. #==============================================================================
  1114.  
  1115. class Game_Character
  1116.   #--------------------------------------------------------------------------
  1117.   # ● フレーム更新 (移動)
  1118.   #--------------------------------------------------------------------------
  1119.   def update_move
  1120.     # 移動速度からマップ座標系での移動距離に変換
  1121.     distance = 2 ** @move_speed
  1122.     if @x * 128 != @real_x and @y * 128 != @real_y and Game_Player::SLANT
  1123.       distance /= Math.sqrt(2)
  1124.     end
  1125.     # 論理座標が実座標より下の場合
  1126.     if @y * 128 > @real_y
  1127.       # 下に移動
  1128.       @real_y = [@real_y + distance, @y * 128].min
  1129.     end
  1130.     # 論理座標が実座標より左の場合
  1131.     if @x * 128 < @real_x
  1132.       # 左に移動
  1133.       @real_x = [@real_x - distance, @x * 128].max
  1134.     end
  1135.     # 論理座標が実座標より右の場合
  1136.     if @x * 128 > @real_x
  1137.       # 右に移動
  1138.       @real_x = [@real_x + distance, @x * 128].min
  1139.     end
  1140.     # 論理座標が実座標より上の場合
  1141.     if @y * 128 < @real_y
  1142.       # 上に移動
  1143.       @real_y = [@real_y - distance, @y * 128].max
  1144.     end
  1145.     # 移動時アニメが ON の場合
  1146.     if @walk_anime
  1147.       # アニメカウントを 1.5 増やす
  1148.       @anime_count += 1.5
  1149.     # 移動時アニメが OFF で、停止時アニメが ON の場合
  1150.     elsif @step_anime
  1151.       # アニメカウントを 1 増やす
  1152.       @anime_count += 1
  1153.     end
  1154.   end
  1155. end
  1156.  
  1157. #==============================================================================
  1158. # ■ Game_Event
  1159. #------------------------------------------------------------------------------
  1160. #  イベントを扱うクラスです。条件判定によるイベントページ切り替えや、並列処理
  1161. # イベント実行などの機能を持っており、Game_Map クラスの内部で使用されます。
  1162. #==============================================================================
  1163. class Game_Event < Game_Character
  1164.   #--------------------------------------------------------------------------
  1165.   # ● イベント起動
  1166.   #--------------------------------------------------------------------------
  1167.   def start
  1168.     # 実行内容が空でない場合
  1169.     if @list.size > 1
  1170.       # $game_player.event が0でない場合
  1171.       if $game_player.event != 0
  1172.         # 移動速度を $game_player.event にする
  1173.         $game_player.move_speed = $game_player.event
  1174.       end
  1175.       @starting = true
  1176.     end
  1177.   end
  1178. end
  1179. end

点评

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

评分

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

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
3
星屑
1612
在线时间
196 小时
注册时间
2018-7-10
帖子
315
5
 楼主| 发表于 2019-1-9 21:19:36 | 只看该作者
我发现这个脚本还有很多其他bug,感觉太麻烦了不想改了,感谢各位的帮助
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-26 08:10

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表