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

Project1

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

[原创发布] 实现了烛台的随机掉落

[复制链接]

Lv5.捕梦者

梦石
0
星屑
34864
在线时间
4148 小时
注册时间
2007-12-15
帖子
9980
跳转到指定楼层
1
发表于 2018-4-26 17:13:37 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 89444640 于 2018-4-26 17:27 编辑


重新测时候,发现烛台掉落简直成摆设了。位置难砍不说,掉落也太固定。实用度不高。
然后改了一个烛台成这样。
终于成功的实现了ACT刷刷刷效果,左右两个方向都能砍了。而且掉落也随机了,其实就是个随机变量,以前做这段时候根本不会用变量。
似乎,想的复杂了,还代入角色当XY变量什么的……其实特定位置触发就行,如果嫌打的位置太固定,再加几个就好了。
用同样的素材实现了更好的模拟效果。
似乎应该随机数再大点……

评分

参与人数 5星屑 +30 +4 收起 理由
牛肉面 + 30 塞糖
21世纪游戏吧 + 1 塞糖
W.Q.C. + 1 塞糖
真·可乐 + 1 塞糖
灯笼菜刀王 + 1 塞糖

查看全部评分

Lv5.捕梦者

梦石
0
星屑
37759
在线时间
5385 小时
注册时间
2006-11-10
帖子
6545
2
发表于 2018-4-26 17:53:54 | 只看该作者
这很恶魔城

又塞个重力脚本?

点评

顺道,废墟肖像的女仆吸尘器有还原,搜下我以前帖子估计能找到,不过别指望吸我主角裙子……我故意没画,只有对话。  发表于 2018-4-28 00:00
理查德也坐过王座,也翘来着,废墟肖像 文森特……不清楚了,反正夏洛特肯定是没翘。这就证明了,恶魔城人物用的一个模板- -b  发表于 2018-4-27 23:58
哪些角色是男的……我画的正面侧面都是双腿并拢的,再说,你看夏诺雅姐翘了吗,玛利亚翘了吗,  发表于 2018-4-27 23:54
当年我说过类似的话,结果某人说教人学坏,所以干脆原曲只有我自己听,反正我不加密,你们随便折腾。可提供场景推荐配乐。用户折腾与我无关  发表于 2018-4-27 23:50
坐在玉座上不翘二郎腿很不恶魔城啊... 德拉库拉就不说了,看看阿鲁卡多,看看西蒙,看看苍真,哪个坐过玉座的没翘腿啊=。=  发表于 2018-4-27 10:05
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2125
在线时间
234 小时
注册时间
2018-3-23
帖子
100
3
发表于 2018-4-26 18:22:49 | 只看该作者

这真的是脚本山了
这是要做恶魔城?

点评

这可真是大工程啊  发表于 2018-4-26 21:07
大概连画地图带动作全补完这段做了两年。因为地图太难画,而且我不太毁画地图,都是从0自学……  发表于 2018-4-26 20:20
这个早就做完了,因为测试,顺道修正点东西,这段运行保守估计一个小时四十分钟的高清恶魔城模拟,但是太难做攻击判定,boss战斗直接看片模式。  发表于 2018-4-26 20:19
RMXP天下第一!
回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
34864
在线时间
4148 小时
注册时间
2007-12-15
帖子
9980
4
 楼主| 发表于 2018-4-26 20:18:16 | 只看该作者
本帖最后由 89444640 于 2018-4-26 20:25 编辑
灯笼菜刀王 发表于 2018-4-26 17:53
这很恶魔城

又塞个重力脚本?


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

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

点评

嘛~扬长避短~扬长避短~,突然想起来我有斜下滑铲动作没做对应地形……弄个出来走过场去。  发表于 2018-4-27 10:52
咱没有研究过重力脚本,原因有二,一素材苦手,二动作苦手... 咱是头脑型玩家XD  发表于 2018-4-27 10:07
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-20 07:52

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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