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

Project1

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

[已经过期] 可以在事件中把这个ACT脚本的空中连跳改成0吗?

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1840
在线时间
367 小时
注册时间
2012-12-10
帖子
427
跳转到指定楼层
1
发表于 2014-11-16 19:38:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

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

Lv3.寻梦者

梦石
0
星屑
1840
在线时间
367 小时
注册时间
2012-12-10
帖子
427
2
 楼主| 发表于 2014-11-16 19:41:17 | 只看该作者
本帖最后由 梦·林夕 于 2014-11-16 19:55 编辑

……不用了,我会 了……在脚本里面输入$airjump = 0  #空中连跳

但是可以把跳的高度也改一下吗?
『我对你矢志不渝。』
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-22 15:26

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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