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

Project1

 找回密码
 注册会员
搜索
查看: 1901|回复: 1

[已经解决] 求个伪8方向行走脚本

 关闭 [复制链接]

Lv4.逐梦者

梦石
0
星屑
4989
在线时间
453 小时
注册时间
2011-2-11
帖子
1108
发表于 2011-4-23 12:03:53 | 显示全部楼层 |阅读模式
我说的伪8方向行走,不是商业素材的那种。
指的是默认行走图摁住上,然后在摁左,角色就可以往左上行走。
就像66的【黑剑】那样的行走。

我也找了个,只是手感不怎么样。
所以求66【黑剑】里的行走方式、
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

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

  8. #==============================================================================
  9. # ■ Game_Player
  10. #------------------------------------------------------------------------------
  11. #  プレイヤーを扱うクラスです。イベントの起動判定や、マップのスクロールなどの
  12. # 機能を持っています。このクラスのインスタンスは $game_player で参照されます。
  13. #==============================================================================

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

  1007. #==============================================================================
  1008. # ■ Game_Character (分割定義 1)
  1009. #------------------------------------------------------------------------------
  1010. #  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
  1011. # クラスのスーパークラスとして使用されます。
  1012. #==============================================================================

  1013. class Game_Character
  1014.   #--------------------------------------------------------------------------
  1015.   # ● フレーム更新 (移動)
  1016.   #--------------------------------------------------------------------------
  1017.   def update_move
  1018.     # 移動速度からマップ座標系での移動距離に変換
  1019.     distance = 2 ** @move_speed
  1020.     if @x * 128 != @real_x and @y * 128 != @real_y and Game_Player::SLANT
  1021.       distance /= Math.sqrt(2)
  1022.     end
  1023.     # 論理座標が実座標より下の場合
  1024.     if @y * 128 > @real_y
  1025.       # 下に移動
  1026.       @real_y = [@real_y + distance, @y * 128].min
  1027.     end
  1028.     # 論理座標が実座標より左の場合
  1029.     if @x * 128 < @real_x
  1030.       # 左に移動
  1031.       @real_x = [@real_x - distance, @x * 128].max
  1032.     end
  1033.     # 論理座標が実座標より右の場合
  1034.     if @x * 128 > @real_x
  1035.       # 右に移動
  1036.       @real_x = [@real_x + distance, @x * 128].min
  1037.     end
  1038.     # 論理座標が実座標より上の場合
  1039.     if @y * 128 < @real_y
  1040.       # 上に移動
  1041.       @real_y = [@real_y - distance, @y * 128].max
  1042.     end
  1043.     # 移動時アニメが ON の場合
  1044.     if @walk_anime
  1045.       # アニメカウントを 1.5 増やす
  1046.       @anime_count += 1.5
  1047.     # 移動時アニメが OFF で、停止時アニメが ON の場合
  1048.     elsif @step_anime
  1049.       # アニメカウントを 1 増やす
  1050.       @anime_count += 1
  1051.     end
  1052.   end
  1053. end

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

  1060. class Game_Event < Game_Character
  1061.   #--------------------------------------------------------------------------
  1062.   # ● イベント起動
  1063.   #--------------------------------------------------------------------------
  1064.   def start
  1065.     # 実行内容が空でない場合
  1066.     if @list.size > 1
  1067.       # $game_player.event が0でない場合
  1068.       if $game_player.event != 0
  1069.         # 移動速度を $game_player.event にする
  1070.         $game_player.move_speed = $game_player.event
  1071.       end
  1072.       @starting = true
  1073.     end
  1074.   end
  1075. end

  1076. #==============================================================================
  1077. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  1078. #==============================================================================
复制代码

评分

参与人数 1星屑 +40 收起 理由
eve592370698 + 40 我有新的帖子了,回帖给高分。.

查看全部评分

Lv2.观梦者

虚構歪曲

梦石
0
星屑
304
在线时间
1194 小时
注册时间
2010-12-18
帖子
3928

贵宾

发表于 2011-4-23 12:05:49 | 显示全部楼层
  1. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
  2. #_/    ◆ ダッシュ&8方向移動 - KGC_Dash_8DirMove ◆
  3. #_/    ◇ Last update : 2007/04/28 ◇
  4. #_/----------------------------------------------------------------------------
  5. #_/  マップ移動時のダッシュ&8方向移動機能を追加します。
  6. #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

  7. #==============================================================================
  8. # ★ カスタマイズ項目 ★
  9. #==============================================================================

  10. module KGC
  11.   # ◆ダッシュボタン
  12.   D8DM_DASH_BUTTON = Input::R
  13.   # ◆ダッシュ速度
  14.   D8DM_DASH_SPEED = 4
  15.   # ◆歩行速度
  16.   D8DM_WALK_SPEED = 4
  17. end

  18. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  19. $imported = {} if $imported == nil
  20. $imported["Dash_8DirMove"] = true

  21. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  22. module Dash
  23.   #--------------------------------------------------------------------------
  24.   # ● 一時ダッシュ速度指定
  25.   #--------------------------------------------------------------------------
  26.   def self.dash_speed=(value)
  27.     $game_system.temp_dash_speed = value
  28.   end
  29.   #--------------------------------------------------------------------------
  30.   # ● 一時歩行速度指定
  31.   #--------------------------------------------------------------------------
  32.   def self.walk_speed=(value)
  33.     $game_system.temp_walk_speed = value
  34.   end
  35.   #--------------------------------------------------------------------------
  36.   # ● 一時ダッシュ/歩行速度設定を解除
  37.   #--------------------------------------------------------------------------
  38.   def self.reset_speed
  39.     $game_system.temp_dash_speed = nil
  40.     $game_system.temp_walk_speed = nil
  41.   end
  42. end

  43. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  44. #==============================================================================
  45. # ■ Game_System
  46. #==============================================================================

  47. class Game_System
  48.   #--------------------------------------------------------------------------
  49.   # ● 公開インスタンス変数
  50.   #--------------------------------------------------------------------------
  51.   attr_accessor :dash_permit              # ダッシュ許可フラグ
  52.   attr_accessor :dir8_permit              # 8方向移動許可フラグ
  53.   attr_accessor :temp_dash_speed          # ダッシュ速度(一時)
  54.   attr_accessor :temp_walk_speed          # 歩行速度(一時)
  55.   #--------------------------------------------------------------------------
  56.   # ● オブジェクト初期化
  57.   #--------------------------------------------------------------------------
  58.   alias initialize_KGC_Dash_8DirMove initialize
  59.   def initialize
  60.     initialize_KGC_Dash_8DirMove

  61.     @dash_permit = true
  62.     @dir8_permit = true
  63.     @temp_dash_speed = nil
  64.     @temp_walk_speed = nil
  65.   end
  66. end

  67. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★

  68. #==============================================================================
  69. # ■ Game_Player
  70. #==============================================================================

  71. class Game_Player < Game_Character
  72.   #--------------------------------------------------------------------------
  73.   # ● フレーム更新
  74.   #--------------------------------------------------------------------------
  75.   def update
  76.     # ローカル変数に移動中かどうかを記憶
  77.     last_moving = moving?
  78.     # 移動中、イベント実行中、移動ルート強制中、
  79.     # メッセージウィンドウ表示中のいずれでもない場合
  80.     unless moving? or $game_system.map_interpreter.running? or
  81.            @move_route_forcing or $game_temp.message_window_showing
  82.       # 向きを保存
  83.       direction = @direction
  84.       # 方向ボタンが押されていれば、その方向へプレイヤーを移動
  85.       if $game_system.dir8_permit
  86.         case Input.dir8
  87.         when 1  # 左下
  88.           move_left
  89.           move_down
  90.           # 向き固定でない場合
  91.           unless @direction_fix
  92.             # 右向きだった場合は左を、上向きだった場合は下を向く
  93.             @direction = (direction == 6 ? 4 : direction == 8 ? 2 : direction)
  94.           end
  95.         when 2  # 下
  96.           move_down
  97.         when 3  # 右下
  98.           move_down
  99.           move_right
  100.           # 向き固定でない場合
  101.           unless @direction_fix
  102.             # 左向きだった場合は右を、上向きだった場合は下を向く
  103.             @direction = (direction == 4 ? 6 : direction == 8 ? 2 : direction)
  104.           end
  105.         when 4  # 左
  106.           move_left
  107.         when 6  # 右
  108.           move_right
  109.         when 7  # 左上
  110.           move_up
  111.           move_left
  112.           # 向き固定でない場合
  113.           unless @direction_fix
  114.             # 右向きだった場合は左を、下向きだった場合は上を向く
  115.             @direction = (direction == 6 ? 4 : direction == 2 ? 8 : direction)
  116.           end
  117.         when 8  # 上
  118.           move_up
  119.         when 9  # 右上
  120.           move_right
  121.           move_up
  122.           # 向き固定でない場合
  123.           unless @direction_fix
  124.             # 左向きだった場合は右を、下向きだった場合は上を向く
  125.             @direction = (direction == 4 ? 6 : direction == 2 ? 8 : direction)
  126.           end
  127.         end
  128.       else
  129.         case Input.dir4
  130.         when 2
  131.           move_down
  132.         when 4
  133.           move_left
  134.         when 6
  135.           move_right
  136.         when 8
  137.           move_up
  138.         end
  139.       end

  140.       # 歩行速度調整
  141.       if $game_system.dash_permit && Input.press?(KGC::D8DM_DASH_BUTTON)
  142.         if $game_system.temp_dash_speed == nil
  143.           @move_speed = KGC::D8DM_DASH_SPEED
  144.           $dash = true
  145.         else
  146.           @move_speed = $game_system.temp_dash_speed
  147.         end
  148.       else
  149.         if $game_system.temp_walk_speed == nil
  150.           @move_speed = KGC::D8DM_WALK_SPEED
  151.           $dash = false
  152.         else
  153.           @move_speed = $game_system.temp_walk_speed
  154.         end
  155.       end
  156.     end
  157.     # ローカル変数に座標を記憶
  158.     last_real_x = @real_x
  159.     last_real_y = @real_y
  160.     super
  161.     # キャラクターが下に移動し、かつ画面上の位置が中央より下の場合
  162.     if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  163.       # マップを下にスクロール
  164.       $game_map.scroll_down(@real_y - last_real_y)
  165.     end
  166.     # キャラクターが左に移動し、かつ画面上の位置が中央より左の場合
  167.     if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  168.       # マップを左にスクロール
  169.       $game_map.scroll_left(last_real_x - @real_x)
  170.     end
  171.     # キャラクターが右に移動し、かつ画面上の位置が中央より右の場合
  172.     if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  173.       # マップを右にスクロール
  174.       $game_map.scroll_right(@real_x - last_real_x)
  175.     end
  176.     # キャラクターが上に移動し、かつ画面上の位置が中央より上の場合
  177.     if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  178.       # マップを上にスクロール
  179.       $game_map.scroll_up(last_real_y - @real_y)
  180.     end
  181.     # 移動中ではない場合
  182.     unless moving?
  183.       # 前回プレイヤーが移動中だった場合
  184.       if last_moving
  185.         # 同位置のイベントとの接触によるイベント起動判定
  186.         result = check_event_trigger_here([1,2])
  187.         # 起動したイベントがない場合
  188.         if result == false
  189.           # デバッグモードが ON かつ CTRL キーが押されている場合を除き
  190.           unless $DEBUG and Input.press?(Input::CTRL)
  191.             # エンカウント カウントダウン
  192.             if @encounter_count > 0
  193.               @encounter_count -= 1
  194.             end
  195.           end
  196.         end
  197.       end
  198.       # C ボタンが押された場合
  199.       if Input.trigger?(Input::C)
  200.         # 同位置および正面のイベント起動判定
  201.         check_event_trigger_here([0])
  202.         check_event_trigger_there([0,1,2])
  203.       end
  204.     end
  205.   end
  206. end
复制代码

点评

手感不错 。谢了!  发表于 2011-4-23 12:11
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 10:02

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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