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

Project1

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

[已经解决] 求横版行走、战斗与用图片描绘HP、SP的脚本!

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
13 小时
注册时间
2007-6-13
帖子
458
跳转到指定楼层
1
发表于 2010-7-6 00:48:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 败笔 于 2010-7-9 03:35 编辑

问题如题了!
有那个就发那个了....
放这么久都给埋没了...


现在不知道怎么结贴了...
自己编辑下!
感谢小角色!
空 憂 憂

Lv1.梦旅人

梦石
0
星屑
50
在线时间
13 小时
注册时间
2007-6-13
帖子
458
2
 楼主| 发表于 2010-7-6 13:34:15 | 只看该作者
被埋没了?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

不画画就死星人

梦石
0
星屑
164
在线时间
1818 小时
注册时间
2007-6-14
帖子
3219
3
发表于 2010-7-6 15:24:35 | 只看该作者
横版ARPG的范例貌似都死链了,建议LZ尝试去搜[RM 冒险岛]之类的关键字
血条的,也许不是用图片 http://rpg.blue/htm/Topic_42621.htm
渣绘关注慎重
[url=http://www.pixiv.net/member.php?id=1160389][color=DimGray]http://www.pixiv.net/member.php?id=1160389[/color][/url]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
13 小时
注册时间
2007-6-13
帖子
458
4
 楼主| 发表于 2010-7-6 16:32:55 | 只看该作者
横版ARPG的范例貌似都死链了,建议LZ尝试去搜[RM 冒险岛]之类的关键字
血条的,也许不是用图片  ...
小角色 发表于 2010-7-6 15:24


不要求是ARPG,只要横走的就可以!


回复 支持 反对

使用道具 举报

Lv1.梦旅人

不画画就死星人

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

  1094. #==============================================================================
  1095. # ■ Game_Character (分割定義 1)
  1096. #------------------------------------------------------------------------------
  1097. #  キャラクターを扱うクラスです。このクラスは Game_Player クラスと Game_Event
  1098. # クラスのスーパークラスとして使用されます。
  1099. #==============================================================================

  1100. class Game_Character
  1101.   #--------------------------------------------------------------------------
  1102.   # ● フレーム更新 (移動)
  1103.   #--------------------------------------------------------------------------
  1104.   def update_move
  1105.     # 移動速度からマップ座標系での移動距離に変換
  1106.     distance = 2 ** @move_speed
  1107.     if @x * 128 != @real_x and @y * 128 != @real_y and Game_Player::SLANT
  1108.       distance /= Math.sqrt(2)
  1109.     end
  1110.     # 論理座標が実座標より下の場合
  1111.     if @y * 128 > @real_y
  1112.       # 下に移動
  1113.       @real_y = [@real_y + distance, @y * 128].min
  1114.     end
  1115.     # 論理座標が実座標より左の場合
  1116.     if @x * 128 < @real_x
  1117.       # 左に移動
  1118.       @real_x = [@real_x - distance, @x * 128].max
  1119.     end
  1120.     # 論理座標が実座標より右の場合
  1121.     if @x * 128 > @real_x
  1122.       # 右に移動
  1123.       @real_x = [@real_x + distance, @x * 128].min
  1124.     end
  1125.     # 論理座標が実座標より上の場合
  1126.     if @y * 128 < @real_y
  1127.       # 上に移動
  1128.       @real_y = [@real_y - distance, @y * 128].max
  1129.     end
  1130.     # 移動時アニメが ON の場合
  1131.     if @walk_anime
  1132.       # アニメカウントを 1.5 増やす
  1133.       @anime_count += 1.5
  1134.     # 移動時アニメが OFF で、停止時アニメが ON の場合
  1135.     elsif @step_anime
  1136.       # アニメカウントを 1 増やす
  1137.       @anime_count += 1
  1138.     end
  1139.   end
  1140. end
  1141. end
复制代码
这是我用过的,建议你大致读一遍

点评

235-244是我自己加的事件,你不必理会  发表于 2010-7-6 18:16
渣绘关注慎重
[url=http://www.pixiv.net/member.php?id=1160389][color=DimGray]http://www.pixiv.net/member.php?id=1160389[/color][/url]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
112 小时
注册时间
2010-7-5
帖子
183
6
发表于 2010-7-9 00:13:57 | 只看该作者
脚本好长  害得我慢慢框其按ALT+C时   我看见下面有一个复制代码…………………………………………………………………………………………………………………………………………

点评

moy
= =第三次看到你了,这不是水区,不要发无关回复和吐槽  发表于 2010-7-9 00:25
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2010-7-8
帖子
7
7
发表于 2010-7-9 16:26:19 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-3 10:22

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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