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

Project1

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

[已经过期] 让主角可以打斜走并且不是按格子

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
134 小时
注册时间
2009-3-29
帖子
470
跳转到指定楼层
1
发表于 2010-9-12 14:36:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
游戏制作大师手感不好就在这里,按一下←,走完一格踩停下,以前我用过一个脚本,可以按任何方向走并且不受格子控制,按住↑+→面向上然后45度走

Lv1.梦旅人

梦石
0
星屑
50
在线时间
416 小时
注册时间
2006-10-21
帖子
1245
2
发表于 2010-9-12 14:50:56 | 只看该作者
自言自语
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
154
在线时间
157 小时
注册时间
2009-2-15
帖子
146
3
发表于 2010-9-12 16:18:29 | 只看该作者
八方行走这个八方行走就可以达到lz说的效果
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
134 小时
注册时间
2009-3-29
帖子
470
4
 楼主| 发表于 2010-9-21 17:45:11 | 只看该作者
不是这个,我要不按格子的,这个还是按格子
黑之结界勇士
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (暗夜天使)

名侦探小柯

梦石
0
星屑
3299
在线时间
3619 小时
注册时间
2006-9-6
帖子
37400

开拓者贵宾第3届短篇游戏大赛主流游戏组亚军第5届短篇游戏比赛亚军

5
发表于 2010-9-21 17:51:39 | 只看该作者
XP里看到过,什么dot像素移动……
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
134 小时
注册时间
2009-3-29
帖子
470
6
 楼主| 发表于 2010-9-24 12:17:04 | 只看该作者
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
38 小时
注册时间
2009-5-23
帖子
358
7
发表于 2010-9-24 12:28:45 | 只看该作者
本帖最后由 猫猫~ 于 2010-9-24 12:30 编辑

不就是全方向移动么?
  1. 全方向ドット移動 Ver ε
复制代码
  1. $ud_ok = true #上下失效
  2. $airjump = 1  #空中连跳
  3. #==============================================================================
  4. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  5. #==============================================================================

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

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

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

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

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

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

  1128. #==============================================================================
  1129. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  1130. #==============================================================================
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

小黑

梦石
0
星屑
50
在线时间
140 小时
注册时间
2011-8-23
帖子
536
8
发表于 2011-8-23 11:49:00 | 只看该作者
  1. =begin
  2. ================================================================================
  3. Amethyst Custom Movement - v1.2 RMVX - 25/03/2010
  4. ================================================================================

  5. --------------------------------------------------------------------------------
  6. Credits\Terms of Use
  7. --------------------------------------------------------------------------------
  8. Created by Khas ([email protected])
  9. All Amethyst Scripts are licensed under a Creative Commons license
  10. All Amethyst Scripts are for non-commercial projects, if you need
  11. them for a commercial game, please send a email to [email protected]

  12. --------------------------------------------------------------------------------
  13. Features
  14. --------------------------------------------------------------------------------
  15. This script creates an advanced movement, including "half-tile" step,
  16. diagonal movement and an advanced touch trigger feature.
  17. ACM is also compatible with RMVX vehicles

  18. --------------------------------------------------------------------------------
  19. Configuration
  20. --------------------------------------------------------------------------------
  21. =end
  22. module Amcm_Config
  23.   # Enable Diagonal movement for Player?
  24.   Enable_Player_Diagonal = true
  25.   # Enable Diagonal movement for events?
  26.   Enable_Event_Diagonal = true
  27.   # Enable "half-tile" step for events?
  28.   Enable_Event_Movement = true
  29.   # Enable Advanced Trigger Touch feature?
  30.   Enable_Advanced_Touch = true
  31. end
  32. #-------------------------------------------------------------------------------

  33. $Amethyst_Scripts = {} if $Amethyst_Scripts.nil?
  34. $Amethyst_Scripts["Am Custom Movement"] = ["1.2","25/03/2010"]

  35. class Game_Character
  36.   def amcm_integer?(value)
  37.     i = value.to_i; return value == i
  38.   end
  39.   def pos?(x, y)
  40.     if amcm_integer?(@x)
  41.       if amcm_integer?(@y)
  42.         return (@x == x and @y == y)
  43.       else
  44.         return (@x == x and (@y.to_i == y or @y.to_i+1 == y))
  45.       end
  46.     elsif amcm_integer?(@y)
  47.       return ((@x.to_i == x or @x.to_i+1 == x) and @y == y)
  48.     else
  49.       return ((@x.to_i == x or @x.to_i+1 == x)and(@y.to_i == y or @y.to_i+1 == y))
  50.     end
  51.   end
  52.   if Amcm_Config::Enable_Event_Diagonal
  53.     def move_random
  54.       case rand(8)
  55.       when 0; move_down(false)
  56.       when 1; move_left(false)
  57.       when 2; move_right(false)
  58.       when 3; move_up(false)
  59.       when 4; move_lower_left
  60.       when 5; move_lower_right
  61.       when 6; move_upper_left
  62.       when 7; move_upper_right
  63.       end
  64.     end
  65.   end
  66.   if Amcm_Config::Enable_Event_Movement
  67.     def move_down(turn_ok = true)
  68.       if amcm_integer?(@x)
  69.         if amcm_integer?(@y)
  70.           if passable?(@x, @y+1)
  71.             turn_down
  72.             @y = $game_map.round_y(@y+0.5)
  73.             @real_y = (@y-0.5)*256
  74.             increase_steps
  75.             @move_failed = false
  76.           else
  77.             turn_down if turn_ok
  78.             check_event_trigger_touch(@x, @y+1)
  79.             @move_failed = true
  80.           end
  81.         else
  82.           turn_down
  83.           @y = $game_map.round_y(@y+0.5)
  84.           @real_y = (@y-0.5)*256
  85.           increase_steps
  86.           @move_failed = false
  87.         end
  88.       elsif amcm_integer?(@y)
  89.         if passable?(@x.to_i, @y+1) and passable?(@x.to_i+1, @y+1)
  90.           turn_down
  91.           @y = $game_map.round_y(@y+0.5)
  92.           @real_y = (@y-0.5)*256
  93.           increase_steps
  94.           @move_failed = false
  95.         else
  96.           turn_down if turn_ok
  97.           check_event_trigger_touch(@x.to_i+1, @y+1)
  98.           check_event_trigger_touch(@x.to_i, @y+1)
  99.           @move_failed = true
  100.         end
  101.       else
  102.         turn_down
  103.         @y = $game_map.round_y(@y+0.5)
  104.         @real_y = (@y-0.5)*256
  105.         increase_steps
  106.         @move_failed = false
  107.       end
  108.     end
  109.     def move_up(turn_ok = true)
  110.       if amcm_integer?(@x)
  111.         if amcm_integer?(@y)
  112.           if passable?(@x, @y-1)
  113.             turn_up
  114.             @y = $game_map.round_y(@y-0.5)
  115.             @real_y = (@y+0.5)*256
  116.             increase_steps
  117.             @move_failed = false
  118.           else
  119.             turn_up if turn_ok
  120.             check_event_trigger_touch(@x, @y-1)
  121.             @move_failed = true
  122.           end
  123.         else
  124.           turn_up
  125.           @y = $game_map.round_y(@y-0.5)
  126.           @real_y = (@y+0.5)*256
  127.           increase_steps
  128.           @move_failed = false
  129.         end
  130.       elsif amcm_integer?(@y)
  131.         if passable?(@x.to_i, @y-1) and passable?(@x.to_i+1, @y-1)
  132.           turn_up
  133.           @y = $game_map.round_y(@y-0.5)
  134.           @real_y = (@y+0.5)*256
  135.           increase_steps
  136.           @move_failed = false
  137.         else
  138.           turn_up if turn_ok
  139.           check_event_trigger_touch(@x.to_i, @y-1)
  140.           check_event_trigger_touch(@x.to_i+1, @y-1)
  141.           @move_failed = true
  142.         end
  143.       else
  144.         turn_up
  145.         @y = $game_map.round_y(@y-0.5)
  146.         @real_y = (@y+0.5)*256
  147.         increase_steps
  148.         @move_failed = false
  149.       end
  150.     end
  151.     def move_left(turn_ok = true)
  152.       if amcm_integer?(@y)
  153.         if amcm_integer?(@x)
  154.           if passable?(@x-1, @y)
  155.             turn_left
  156.             @x = $game_map.round_x(@x-0.5)
  157.             @real_x = (@x+0.5)*256
  158.             increase_steps
  159.             @move_failed = false
  160.           else
  161.             turn_left if turn_ok
  162.             check_event_trigger_touch(@x-1, @y)
  163.             @move_failed = true
  164.           end
  165.         else
  166.           turn_left
  167.           @x = $game_map.round_x(@x-0.5)
  168.           @real_x = (@x+0.5)*256
  169.           increase_steps
  170.           @move_failed = false
  171.         end
  172.       elsif amcm_integer?(@x)
  173.         if passable?(@x-1,@y.to_i) and passable?(@x-1,@y.to_i+1)
  174.           turn_left
  175.           @x = $game_map.round_x(@x-0.5)
  176.           @real_x = (@x+0.5)*256
  177.           increase_steps
  178.           @move_failed = false
  179.         else
  180.           turn_left if turn_ok
  181.           check_event_trigger_touch(@x-1, @y.to_i)
  182.           check_event_trigger_touch(@x-1, @y.to_i+1)
  183.           @move_failed = true
  184.         end
  185.       else
  186.         turn_left
  187.         @x = $game_map.round_x(@x-0.5)
  188.         @real_x = (@x+0.5)*256
  189.         increase_steps
  190.         @move_failed = false
  191.       end
  192.     end
  193.     def move_right(turn_ok = true)
  194.       if amcm_integer?(@y)
  195.         if amcm_integer?(@x)
  196.           if passable?(@x+1, @y)
  197.             turn_right
  198.             @x = $game_map.round_x(@x+0.5)
  199.             @real_x = (@x-0.5)*256
  200.             increase_steps
  201.             @move_failed = false
  202.           else
  203.             turn_right if turn_ok
  204.             check_event_trigger_touch(@x+1, @y)
  205.             @move_failed = true
  206.           end
  207.         else
  208.           turn_right
  209.           @x = $game_map.round_x(@x+0.5)
  210.           @real_x = (@x-0.5)*256
  211.           increase_steps
  212.           @move_failed = false
  213.         end
  214.       elsif amcm_integer?(@x)
  215.         if passable?(@x+1,@y.to_i) and passable?(@x+1,@y.to_i+1)
  216.           turn_right
  217.           @x = $game_map.round_x(@x+0.5)
  218.           @real_x = (@x-0.5)*256
  219.           increase_steps
  220.           @move_failed = false
  221.         else
  222.           turn_right if turn_ok
  223.           check_event_trigger_touch(@x+1, @y.to_i)
  224.           check_event_trigger_touch(@x+1, @y.to_i+1)
  225.           @move_failed = true
  226.         end
  227.       else
  228.         turn_right
  229.         @x = $game_map.round_x(@x+0.5)
  230.         @real_x = (@x-0.5)*256
  231.         increase_steps
  232.         @move_failed = false
  233.       end
  234.     end
  235.     def move_lower_left
  236.       unless @direction_fix
  237.         @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
  238.       end
  239.       if amcm_integer?(@x)
  240.         if amcm_integer?(@y)
  241.           if passable?(@x-1,@y) and passable?(@x-1,@y+1) and passable?(@x,@y+1)
  242.             @x -= 0.5
  243.             @y += 0.5
  244.             increase_steps
  245.             @move_failed = false
  246.           else
  247.             @move_failed = true
  248.           end
  249.         else
  250.           if passable?(@x-1,@y.to_i+1)
  251.             @x -= 0.5
  252.             @y += 0.5
  253.             increase_steps
  254.             @move_failed = false
  255.           else
  256.             @move_failed = true
  257.           end
  258.         end
  259.       elsif amcm_integer?(@y)
  260.         if passable?(@x.to_i,@y+1)
  261.           @x -= 0.5
  262.           @y += 0.5
  263.           increase_steps
  264.           @move_failed = false
  265.         else
  266.           @move_failed = true
  267.         end
  268.       else
  269.         @x -= 0.5
  270.         @y += 0.5
  271.         increase_steps
  272.         @move_failed = false
  273.       end
  274.     end
  275.     def move_lower_right
  276.       unless @direction_fix
  277.         @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
  278.       end
  279.       if amcm_integer?(@x)
  280.         if amcm_integer?(@y)
  281.           if passable?(@x+1,@y) and passable?(@x+1,@y+1) and passable?(@x,@y+1)
  282.             @x += 0.5
  283.             @y += 0.5
  284.             increase_steps
  285.             @move_failed = false
  286.           else
  287.             @move_failed = true
  288.           end
  289.         else
  290.           if passable?(@x+1,@y.to_i+1)
  291.             @x += 0.5
  292.             @y += 0.5
  293.             increase_steps
  294.             @move_failed = false
  295.           else
  296.             @move_failed = true
  297.           end
  298.         end
  299.       elsif amcm_integer?(@y)
  300.         if passable?(@x.to_i+1,@y+1)
  301.           @x += 0.5
  302.           @y += 0.5
  303.           increase_steps
  304.           @move_failed = false
  305.         else
  306.           @move_failed = true
  307.         end
  308.       else
  309.         @x += 0.5
  310.         @y += 0.5
  311.         increase_steps
  312.         @move_failed = false
  313.       end
  314.     end
  315.     def move_upper_left
  316.       unless @direction_fix
  317.         @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
  318.       end
  319.       if amcm_integer?(@x)
  320.         if amcm_integer?(@y)
  321.           if passable?(@x-1,@y) and passable?(@x-1,@y-1) and passable?(@x,@y-1)
  322.             @x -= 0.5
  323.             @y -= 0.5
  324.             increase_steps
  325.             @move_failed = false
  326.           else
  327.             @move_failed = true
  328.           end
  329.         else
  330.           if passable?(@x-1,@y.to_i)
  331.             @x -= 0.5
  332.             @y -= 0.5
  333.             increase_steps
  334.             @move_failed = false
  335.           else
  336.             @move_failed = true
  337.           end
  338.         end
  339.       elsif amcm_integer?(@y)
  340.         if passable?(@x.to_i,@y-1)
  341.           @x -= 0.5
  342.           @y -= 0.5
  343.           increase_steps
  344.           @move_failed = false
  345.         else
  346.           @move_failed = true
  347.         end
  348.       else
  349.         @x -= 0.5
  350.         @y -= 0.5
  351.         increase_steps
  352.         @move_failed = false
  353.       end
  354.     end
  355.     def move_upper_right
  356.       unless @direction_fix
  357.         @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
  358.       end
  359.       if amcm_integer?(@x)
  360.         if amcm_integer?(@y)
  361.           if passable?(@x+1,@y) and passable?(@x+1,@y-1) and passable?(@x,@y-1)
  362.             @x += 0.5
  363.             @y -= 0.5
  364.             increase_steps
  365.             @move_failed = false
  366.           else
  367.             @move_failed = true
  368.           end
  369.         else
  370.           if passable?(@x+1,@y.to_i)
  371.             @x += 0.5
  372.             @y -= 0.5
  373.             increase_steps
  374.             @move_failed = false
  375.           else
  376.             @move_failed = true
  377.           end
  378.         end
  379.       elsif amcm_integer?(@y)
  380.         if passable?(@x.to_i+1,@y-1)
  381.           @x += 0.5
  382.           @y -= 0.5
  383.           increase_steps
  384.           @move_failed = false
  385.         else
  386.           @move_failed = true
  387.         end
  388.       else
  389.         @x += 0.5
  390.         @y -= 0.5
  391.         increase_steps
  392.         @move_failed = false
  393.       end
  394.     end
  395.   end
  396. end

  397. class Game_Player < Game_Character
  398.   if Amcm_Config::Enable_Player_Diagonal
  399.     def move_by_input
  400.       @run_event = false
  401.       return unless movable?
  402.       return if $game_map.interpreter.running?
  403.       case Input.dir8
  404.       when 1; move_lower_left
  405.       when 2; move_down
  406.       when 3; move_lower_right  
  407.       when 4; move_left
  408.       when 6; move_right
  409.       when 7; move_upper_left
  410.       when 8; move_up
  411.       when 9; move_upper_right
  412.       end
  413.     end
  414.   end
  415.   def get_amx(plus=false)
  416.     if plus
  417.       case @direction
  418.       when 2; amcm_integer?(@x) ? i = @x : i = false
  419.       when 4; amcm_integer?(@x) ? i = @x-1 : i = false
  420.       when 6; amcm_integer?(@x) ? i = @x+1 : i = false
  421.       when 8; amcm_integer?(@x) ? i = @x : i = false
  422.       end
  423.       return i
  424.     else
  425.       amcm_integer?(@x) ? i = @x : i = [@x.to_i,@x.to_i+1]; return i
  426.     end
  427.   end
  428.   def get_amy(plus=false)
  429.     if plus
  430.       case @direction
  431.       when 2; amcm_integer?(@y) ? i = @y+1 : i = false
  432.       when 4; amcm_integer?(@y) ? i = @y : i = false
  433.       when 6; amcm_integer?(@y) ? i = @y : i = false
  434.       when 8; amcm_integer?(@y) ? i = @y-1 : i = false
  435.       end
  436.       return i
  437.     else
  438.       amcm_integer?(@y) ? i = @y : i = [@y.to_i,@y.to_i+1]; return i
  439.     end
  440.   end
  441.   if Amcm_Config::Enable_Advanced_Touch
  442.     def check_event_trigger_here(triggers)
  443.       return false if $game_map.interpreter.running?
  444.       result = false
  445.       ax = get_amx
  446.       ay = get_amy
  447.       if ax.is_a?(Array)
  448.         if ay.is_a?(Array)
  449.           for event in $game_map.events_xy(ax[0],ay[0])
  450.             if triggers.include?(event.trigger) and event.priority_type != 1
  451.               event.start
  452.               return true if event.starting
  453.             end
  454.           end
  455.           for event in $game_map.events_xy(ax[0],ay[1])
  456.             if triggers.include?(event.trigger) and event.priority_type != 1
  457.               event.start
  458.               return true if event.starting
  459.             end
  460.           end
  461.           for event in $game_map.events_xy(ax[1],ay[0])
  462.             if triggers.include?(event.trigger) and event.priority_type != 1
  463.               event.start
  464.               return true if event.starting
  465.             end
  466.           end
  467.           for event in $game_map.events_xy(ax[1],ay[1])
  468.             if triggers.include?(event.trigger) and event.priority_type != 1
  469.               event.start
  470.               return true if event.starting
  471.             end
  472.           end
  473.         else
  474.           for event in $game_map.events_xy(ax[0],ay)
  475.             if triggers.include?(event.trigger) and event.priority_type != 1
  476.               event.start
  477.               return true if event.starting
  478.             end
  479.           end
  480.           for event in $game_map.events_xy(ax[1],ay)
  481.             if triggers.include?(event.trigger) and event.priority_type != 1
  482.               event.start
  483.               return true if event.starting
  484.             end
  485.           end
  486.         end
  487.       elsif ay.is_a?(Array)
  488.         for event in $game_map.events_xy(ax,ay[0])
  489.           if triggers.include?(event.trigger) and event.priority_type != 1
  490.             event.start
  491.             return true if event.starting
  492.           end
  493.         end
  494.         for event in $game_map.events_xy(ax,ay[1])
  495.           if triggers.include?(event.trigger) and event.priority_type != 1
  496.             event.start
  497.             return true if event.starting
  498.           end
  499.         end
  500.       else
  501.         for event in $game_map.events_xy(ax,ay)
  502.           if triggers.include?(event.trigger) and event.priority_type != 1
  503.             event.start
  504.             return true if event.starting
  505.           end
  506.         end
  507.       end
  508.       return result
  509.     end
  510.   else
  511.     def check_event_trigger_here(triggers)
  512.       return false if $game_map.interpreter.running?
  513.       result = false
  514.       for event in $game_map.events_xy(@x, @y)
  515.         if triggers.include?(event.trigger) and event.priority_type != 1
  516.           event.start
  517.           result = true if event.starting
  518.         end
  519.       end
  520.       return result
  521.     end
  522.   end
  523.   def check_event_trigger_there(triggers)
  524.     return false if $game_map.interpreter.running?
  525.     result = false
  526.     front_x = get_amx(true)
  527.     front_y = get_amy(true)
  528.     return if !front_x or !front_y
  529.     for event in $game_map.events_xy(front_x, front_y)
  530.       if triggers.include?(event.trigger) and event.priority_type == 1
  531.         event.start
  532.         result = true
  533.       end
  534.     end
  535.     if result == false and $game_map.counter?(front_x, front_y)
  536.       front_x = $game_map.x_with_direction(front_x, @direction)
  537.       front_y = $game_map.y_with_direction(front_y, @direction)
  538.       for event in $game_map.events_xy(front_x, front_y)
  539.         if triggers.include?(event.trigger) and event.priority_type == 1
  540.           event.start
  541.           result = true
  542.         end
  543.       end
  544.     end
  545.     return result
  546.   end
  547.   def get_on_vehicle
  548.     front_x = get_amx(true)
  549.     front_y = get_amy(true)
  550.     if $game_map.airship.pos?(@x, @y)
  551.       get_on_airship
  552.       return true
  553.     elsif $game_map.ship.pos?(front_x, front_y)
  554.       get_on_ship
  555.       return true
  556.     elsif $game_map.boat.pos?(front_x, front_y)
  557.       get_on_boat
  558.       return true
  559.     end
  560.     return false
  561.   end
  562.   def force_vland
  563.     if amcm_integer?(@x)
  564.       if amcm_integer?(@y)
  565.         return
  566.       else
  567.         case @direction
  568.         when 2; move_forward
  569.         when 8; move_forward
  570.         else
  571.           case rand(2)
  572.           when 0; move_up
  573.           when 1; move_down
  574.           end
  575.         end
  576.       end
  577.     elsif amcm_integer?(@y)
  578.       case @direction
  579.       when 4; move_forward
  580.       when 6; move_forward
  581.       else
  582.         case rand(2)
  583.         when 0; move_left
  584.         when 1; move_right
  585.         end
  586.       end
  587.     else
  588.       case @direction
  589.       when 2;
  590.         case rand(2)
  591.         when 0; move_lower_right
  592.         when 1; move_lower_left
  593.         end
  594.       when 4;
  595.         case rand(2)
  596.         when 0; move_lower_left
  597.         when 1; move_upper_left
  598.         end
  599.       when 6;
  600.         case rand(2)
  601.         when 0; move_lower_right
  602.         when 1; move_upper_right
  603.         end
  604.       when 8;
  605.         case rand(2)
  606.         when 0; move_upper_right
  607.         when 1; move_upper_left
  608.         end
  609.       end
  610.     end
  611.     return (amcm_integer?(@x) and amcm_integer?(@y))
  612.   end
  613.   def force_move_forward
  614.     @through = true
  615.     move_forward
  616.     move_forward if in_vehicle?
  617.     @through = false
  618.   end
  619.   def get_off_vehicle
  620.     if in_airship?
  621.       return if force_vland
  622.       return unless airship_land_ok?(@x, @y)
  623.     else
  624.       return if force_vland
  625.       front_x = get_amx(true)
  626.       front_y = get_amy(true)
  627.       return unless can_walk?(front_x, front_y)
  628.     end
  629.     $game_map.vehicles[@vehicle_type].get_off
  630.     if in_airship?
  631.       @direction = 2
  632.     else
  633.       force_move_forward
  634.       @transparent = false
  635.     end
  636.     @vehicle_getting_off = true
  637.     @move_speed = 4
  638.     @through = false
  639.     @walking_bgm.play
  640.     make_encounter_count
  641.   end
  642.   if not Amcm_Config::Enable_Event_Movement
  643.     def move_down(turn_ok = true)
  644.       if amcm_integer?(@x)
  645.         if amcm_integer?(@y)
  646.           if passable?(@x, @y+1)
  647.             turn_down
  648.             @y = $game_map.round_y(@y+0.5)
  649.             @real_y = (@y-0.5)*256
  650.             increase_steps
  651.             @move_failed = false
  652.           else
  653.             turn_down if turn_ok
  654.             check_event_trigger_touch(@x, @y+1)
  655.             @move_failed = true
  656.           end
  657.         else
  658.           turn_down
  659.           @y = $game_map.round_y(@y+0.5)
  660.           @real_y = (@y-0.5)*256
  661.           increase_steps
  662.           @move_failed = false
  663.         end
  664.       elsif amcm_integer?(@y)
  665.         if passable?(@x.to_i, @y+1) and passable?(@x.to_i+1, @y+1)
  666.           turn_down
  667.           @y = $game_map.round_y(@y+0.5)
  668.           @real_y = (@y-0.5)*256
  669.           increase_steps
  670.           @move_failed = false
  671.         else
  672.           turn_down if turn_ok
  673.           check_event_trigger_touch(@x.to_i+1, @y+1)
  674.           check_event_trigger_touch(@x.to_i, @y+1)
  675.           @move_failed = true
  676.         end
  677.       else
  678.         turn_down
  679.         @y = $game_map.round_y(@y+0.5)
  680.         @real_y = (@y-0.5)*256
  681.         increase_steps
  682.         @move_failed = false
  683.       end
  684.     end
  685.     def move_up(turn_ok = true)
  686.       if amcm_integer?(@x)
  687.         if amcm_integer?(@y)
  688.           if passable?(@x, @y-1)
  689.             turn_up
  690.             @y = $game_map.round_y(@y-0.5)
  691.             @real_y = (@y+0.5)*256
  692.             increase_steps
  693.             @move_failed = false
  694.           else
  695.             turn_up if turn_ok
  696.             check_event_trigger_touch(@x, @y-1)
  697.             @move_failed = true
  698.           end
  699.         else
  700.           turn_up
  701.           @y = $game_map.round_y(@y-0.5)
  702.           @real_y = (@y+0.5)*256
  703.           increase_steps
  704.           @move_failed = false
  705.         end
  706.       elsif amcm_integer?(@y)
  707.         if passable?(@x.to_i, @y-1) and passable?(@x.to_i+1, @y-1)
  708.           turn_up
  709.           @y = $game_map.round_y(@y-0.5)
  710.           @real_y = (@y+0.5)*256
  711.           increase_steps
  712.           @move_failed = false
  713.         else
  714.           turn_up if turn_ok
  715.           check_event_trigger_touch(@x.to_i, @y-1)
  716.           check_event_trigger_touch(@x.to_i+1, @y-1)
  717.           @move_failed = true
  718.         end
  719.       else
  720.         turn_up
  721.         @y = $game_map.round_y(@y-0.5)
  722.         @real_y = (@y+0.5)*256
  723.         increase_steps
  724.         @move_failed = false
  725.       end
  726.     end
  727.     def move_left(turn_ok = true)
  728.       if amcm_integer?(@y)
  729.         if amcm_integer?(@x)
  730.           if passable?(@x-1, @y)
  731.             turn_left
  732.             @x = $game_map.round_x(@x-0.5)
  733.             @real_x = (@x+0.5)*256
  734.             increase_steps
  735.             @move_failed = false
  736.           else
  737.             turn_left if turn_ok
  738.             check_event_trigger_touch(@x-1, @y)
  739.             @move_failed = true
  740.           end
  741.         else
  742.           turn_left
  743.           @x = $game_map.round_x(@x-0.5)
  744.           @real_x = (@x+0.5)*256
  745.           increase_steps
  746.           @move_failed = false
  747.         end
  748.       elsif amcm_integer?(@x)
  749.         if passable?(@x-1,@y.to_i) and passable?(@x-1,@y.to_i+1)
  750.           turn_left
  751.           @x = $game_map.round_x(@x-0.5)
  752.           @real_x = (@x+0.5)*256
  753.           increase_steps
  754.           @move_failed = false
  755.         else
  756.           turn_left if turn_ok
  757.           check_event_trigger_touch(@x-1, @y.to_i)
  758.           check_event_trigger_touch(@x-1, @y.to_i+1)
  759.           @move_failed = true
  760.         end
  761.       else
  762.         turn_left
  763.         @x = $game_map.round_x(@x-0.5)
  764.         @real_x = (@x+0.5)*256
  765.         increase_steps
  766.         @move_failed = false
  767.       end
  768.     end
  769.     def move_right(turn_ok = true)
  770.       if amcm_integer?(@y)
  771.         if amcm_integer?(@x)
  772.           if passable?(@x+1, @y)
  773.             turn_right
  774.             @x = $game_map.round_x(@x+0.5)
  775.             @real_x = (@x-0.5)*256
  776.             increase_steps
  777.             @move_failed = false
  778.           else
  779.             turn_right if turn_ok
  780.             check_event_trigger_touch(@x+1, @y)
  781.             @move_failed = true
  782.           end
  783.         else
  784.           turn_right
  785.           @x = $game_map.round_x(@x+0.5)
  786.           @real_x = (@x-0.5)*256
  787.           increase_steps
  788.           @move_failed = false
  789.         end
  790.       elsif amcm_integer?(@x)
  791.         if passable?(@x+1,@y.to_i) and passable?(@x+1,@y.to_i+1)
  792.           turn_right
  793.           @x = $game_map.round_x(@x+0.5)
  794.           @real_x = (@x-0.5)*256
  795.           increase_steps
  796.           @move_failed = false
  797.         else
  798.           turn_right if turn_ok
  799.           check_event_trigger_touch(@x+1, @y.to_i)
  800.           check_event_trigger_touch(@x+1, @y.to_i+1)
  801.           @move_failed = true
  802.         end
  803.       else
  804.         turn_right
  805.         @x = $game_map.round_x(@x+0.5)
  806.         @real_x = (@x-0.5)*256
  807.         increase_steps
  808.         @move_failed = false
  809.       end
  810.     end
  811.     def move_lower_left
  812.       unless @direction_fix
  813.         @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
  814.       end
  815.       if amcm_integer?(@x)
  816.         if amcm_integer?(@y)
  817.           if passable?(@x-1,@y) and passable?(@x-1,@y+1) and passable?(@x,@y+1)
  818.             @x -= 0.5
  819.             @y += 0.5
  820.             increase_steps
  821.             @move_failed = false
  822.           else
  823.             @move_failed = true
  824.           end
  825.         else
  826.           if passable?(@x-1,@y.to_i+1)
  827.             @x -= 0.5
  828.             @y += 0.5
  829.             increase_steps
  830.             @move_failed = false
  831.           else
  832.             @move_failed = true
  833.           end
  834.         end
  835.       elsif amcm_integer?(@y)
  836.         if passable?(@x.to_i,@y+1)
  837.           @x -= 0.5
  838.           @y += 0.5
  839.           increase_steps
  840.           @move_failed = false
  841.         else
  842.           @move_failed = true
  843.         end
  844.       else
  845.         @x -= 0.5
  846.         @y += 0.5
  847.         increase_steps
  848.         @move_failed = false
  849.       end
  850.     end
  851.     def move_lower_right
  852.       unless @direction_fix
  853.         @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
  854.       end
  855.       if amcm_integer?(@x)
  856.         if amcm_integer?(@y)
  857.           if passable?(@x+1,@y) and passable?(@x+1,@y+1) and passable?(@x,@y+1)
  858.             @x += 0.5
  859.             @y += 0.5
  860.             increase_steps
  861.             @move_failed = false
  862.           else
  863.             @move_failed = true
  864.           end
  865.         else
  866.           if passable?(@x+1,@y.to_i+1)
  867.             @x += 0.5
  868.             @y += 0.5
  869.             increase_steps
  870.             @move_failed = false
  871.           else
  872.             @move_failed = true
  873.           end
  874.         end
  875.       elsif amcm_integer?(@y)
  876.         if passable?(@x.to_i+1,@y+1)
  877.           @x += 0.5
  878.           @y += 0.5
  879.           increase_steps
  880.           @move_failed = false
  881.         else
  882.           @move_failed = true
  883.         end
  884.       else
  885.         @x += 0.5
  886.         @y += 0.5
  887.         increase_steps
  888.         @move_failed = false
  889.       end
  890.     end
  891.     def move_upper_left
  892.       unless @direction_fix
  893.         @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
  894.       end
  895.       if amcm_integer?(@x)
  896.         if amcm_integer?(@y)
  897.           if passable?(@x-1,@y) and passable?(@x-1,@y-1) and passable?(@x,@y-1)
  898.             @x -= 0.5
  899.             @y -= 0.5
  900.             increase_steps
  901.             @move_failed = false
  902.           else
  903.             @move_failed = true
  904.           end
  905.         else
  906.           if passable?(@x-1,@y.to_i)
  907.             @x -= 0.5
  908.             @y -= 0.5
  909.             increase_steps
  910.             @move_failed = false
  911.           else
  912.             @move_failed = true
  913.           end
  914.         end
  915.       elsif amcm_integer?(@y)
  916.         if passable?(@x.to_i,@y-1)
  917.           @x -= 0.5
  918.           @y -= 0.5
  919.           increase_steps
  920.           @move_failed = false
  921.         else
  922.           @move_failed = true
  923.         end
  924.       else
  925.         @x -= 0.5
  926.         @y -= 0.5
  927.         increase_steps
  928.         @move_failed = false
  929.       end
  930.     end
  931.     def move_upper_right
  932.       unless @direction_fix
  933.         @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
  934.       end
  935.       if amcm_integer?(@x)
  936.         if amcm_integer?(@y)
  937.           if passable?(@x+1,@y) and passable?(@x+1,@y-1) and passable?(@x,@y-1)
  938.             @x += 0.5
  939.             @y -= 0.5
  940.             increase_steps
  941.             @move_failed = false
  942.           else
  943.             @move_failed = true
  944.           end
  945.         else
  946.           if passable?(@x+1,@y.to_i)
  947.             @x += 0.5
  948.             @y -= 0.5
  949.             increase_steps
  950.             @move_failed = false
  951.           else
  952.             @move_failed = true
  953.           end
  954.         end
  955.       elsif amcm_integer?(@y)
  956.         if passable?(@x.to_i+1,@y-1)
  957.           @x += 0.5
  958.           @y -= 0.5
  959.           increase_steps
  960.           @move_failed = false
  961.         else
  962.           @move_failed = true
  963.         end
  964.       else
  965.         @x += 0.5
  966.         @y -= 0.5
  967.         increase_steps
  968.         @move_failed = false
  969.       end
  970.     end
  971.   end
  972. end
复制代码

评分

参与人数 1星屑 -100 收起 理由
忧雪の伤 -100 二次挖坟。

查看全部评分

起码对得起自己。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-23 16:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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