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

Project1

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

[已经解决] 如何实现蓄力跳跃...

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
338 小时
注册时间
2014-7-15
帖子
593
跳转到指定楼层
1
发表于 2014-12-10 17:45:40 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我的意思是根据按下键的时间长短不同,将蓄力分为三段甚至四段,每一段下跳跃的距离都不同。这个要如何才能实现呢?

评分

参与人数 1星屑 +35 收起 理由
︶ㄣ牛排ぶ + 35 下次去置顶的手动认可帖回复认可.

查看全部评分

Lv1.梦旅人

梦石
0
星屑
50
在线时间
338 小时
注册时间
2014-7-15
帖子
593
2
 楼主| 发表于 2014-12-11 00:22:09 | 只看该作者
蓄力槽应该可以通过图片移动实现,但是蓄力时间的判别又该如何呢?
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
3
发表于 2014-12-11 07:16:42 | 只看该作者
判断是否在按键,如果是,某个变量+1,如果不是时当变量符合条件时进行跳跃。这样好像会很影响速度吧……

点评

一直按着变量会一直加吗,还是说按一次才能加一次  发表于 2014-12-11 15:42
回复 支持 反对

使用道具 举报

Lv2.观梦者

会吐槽的画师

梦石
0
星屑
782
在线时间
3431 小时
注册时间
2011-6-10
帖子
6535
4
发表于 2014-12-11 07:52:04 | 只看该作者
重力系统自带的功能吧

点评

不知道Xp有没有 vx和va是用  发表于 2014-12-11 12:31
重力系统是?  发表于 2014-12-11 11:53
长名公主玩家群:372588926 攻略娱乐应有尽有
了解更多新RM游戏,游戏制作请加入RPGmaker支援群:113622890
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1840
在线时间
367 小时
注册时间
2012-12-10
帖子
427
5
发表于 2014-12-11 12:38:25 | 只看该作者
楼主,我这里有XP的跳跃系统,不知道是不是你要的
  1. $airjump = 1  #空中连跳
  2. #==============================================================================
  3. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  4. #==============================================================================

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

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

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

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

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

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

  1127. #==============================================================================
  1128. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  1129. #==============================================================================
复制代码

点评

↓ 见图书馆1L Q & A  发表于 2014-12-11 17:17
39行有误,不能使用,而且我觉得应该没有那么复杂吧...  发表于 2014-12-11 13:10
这是像素移动吧  发表于 2014-12-11 12:43
『我对你矢志不渝。』
回复 支持 反对

使用道具 举报

Lv3.寻梦者 (版主)

…あたしは天使なんかじゃないわ

梦石
0
星屑
2208
在线时间
4033 小时
注册时间
2010-10-4
帖子
10779

开拓者贵宾

6
发表于 2014-12-11 17:39:18 | 只看该作者
仅提供思路:
RUBY 代码复制
  1. class MaybeSomeCharacter
  2.  
  3.   alias update_without_jumping update
  4.   def update
  5.     update_without_jumping
  6.  
  7.     if Input.trigger? Input::C
  8.       @press_frame ||= 0
  9.       @press_frame += 1
  10.     else
  11.       # jump! if @press_frame > 233
  12.       @press_frame = 0
  13.     end
  14.   end
  15.  
  16. end

点评

蓄力没法用其他办法实现吗,一定要用那个press frame吗  发表于 2014-12-12 18:45
↓ 我连个XP都没有,没法给完整回答啊= =  发表于 2014-12-12 12:31
To LZ:所以说XD是仅提供思路啊。To XD:XP区一般不要给一个有启发性的回答,因为,你懂的……  发表于 2014-12-12 09:32
update没有定义  发表于 2014-12-11 18:18
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1840
在线时间
367 小时
注册时间
2012-12-10
帖子
427
7
发表于 2014-12-11 22:52:10 | 只看该作者
额........我也不会脚本,应该是和哪里冲突了吧、、、、
『我对你矢志不渝。』
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
8
发表于 2014-12-12 20:49:03 | 只看该作者
本帖最后由 汪汪 于 2014-12-13 11:39 编辑

class Game_Player < Game_Character
  attr_accessor :xlty
  def update
    #以下修改
    if Input.press?(Input::R) #键盘w键
      @xlty == nil ?  @xlty =1 : @xlty+=1
    else
      @xlty = 0 if @xlty==nil
      if @xlty == 0
      elsif  @xlty <=10
        tyue(1)
      elsif @xlty <=20
        tyue(2)
      elsif @xlty >20
        tyue(3)
      end
      @xlty = 0
    end
    #以上修改
    # 本地变量记录移动信息
    last_moving = moving?
    # 移动中、事件执行中、强制移动路线中、
    # 信息窗口一个也不显示的时候
    unless moving? or $game_system.map_interpreter.running? or
           @move_route_forcing or $game_temp.message_window_showing
      # 如果方向键被按下、主角就朝那个方向移动
      case Input.dir4
      when 2
        move_down
      when 4
        move_left
      when 6
        move_right
      when 8
        move_up
      end
    end
    # 本地变量记忆坐标
    last_real_x = @real_x
    last_real_y = @real_y
    super
    # 角色向下移动、画面上的位置在中央下方的情况下
    if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
      # 画面向下卷动
      $game_map.scroll_down(@real_y - last_real_y)
    end
    # 角色向左移动、画面上的位置在中央左方的情况下
    if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
      # 画面向左卷动
      $game_map.scroll_left(last_real_x - @real_x)
    end
    # 角色向右移动、画面上的位置在中央右方的情况下
    if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
      # 画面向右卷动
      $game_map.scroll_right(@real_x - last_real_x)
    end
    # 角色向上移动、画面上的位置在中央上方的情况下
    if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
      # 画面向上卷动
      $game_map.scroll_up(last_real_y - @real_y)
    end
    # 不在移动中的情况下
    unless moving?
      # 上次主角移动中的情况
      if last_moving
        # 与同位置的事件接触就判定为事件启动
        result = check_event_trigger_here([1,2])
        # 没有可以启动的事件的情况下
        if result == false
          # 调试模式为 ON 并且按下 CTRL 键的情况下除外
          unless $DEBUG and Input.press?(Input::CTRL)
            # 遇敌计数下降
            if @encounter_count > 0
              @encounter_count -= 1
            end
          end
        end
      end
      # 按下 C 键的情况下
      if Input.trigger?(Input::C)
        # 判定为同位置以及正面的事件启动
        check_event_trigger_here([0])
        check_event_trigger_there([0,1,2])
      end
    end
  end
  #向前跳跃脚本
  def tyue(i)
    case @direction
    when 2
      xlty(0, i)
    when 4
      xlty(-i, 0)
    when 6
      xlty(i, 0)
    when 8
      xlty(0, -i)
    end
  end
  #跳跃判断:额,主要是跳跃处有障碍时跳短一点用的
  def xlty(x_plus, y_plus)
    while !passable?(@x + x_plus, @y + y_plus, 0) #and
    #  @x + x_plus>=0 and @y + y_plus >=0
      break if x_plus == 0 and y_plus ==0
      x_plus -= x_plus / x_plus.abs  if x_plus !=0
      y_plus -= y_plus / y_plus.abs  if y_plus != 0
    end
    new_x = @x + x_plus
    new_y = @y + y_plus
    # 增加值为 (0,0) 的情况下、跳跃目标可以通行的场合
    if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
      # 矫正姿势
      straighten
      # 更新坐标
      @x = new_x
      @y = new_y
      # 距计算距离
      distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
      # 设置跳跃记数
      @jump_peak = 10 + distance - @move_speed
      @jump_count = @jump_peak * 2
      # 清除停止记数信息
      @stop_count = 0
    end
  end
end
放在main 前
修改的是Game_Game_Player,
额,因为不知道您要跳多远,直接改成相应跳跃距离就好。  用的是R键(键盘上就是W键)
变量是 $game_player.xlty
建议您根据自己的脚本修改。
额,因为是空工程修改的,所以不知道对速度拖累情况。

点评

开火车。。。。。不知道是哪一个。。具体思路就在跳跃时加上让他们也跳跃的语句。  发表于 2014-12-13 16:28
恩,还有个问题是我加入了队伍开火车的脚本,跟随人物没法一起跳跃  发表于 2014-12-13 16:19
恩,效果已经出来了,我再研究下代码  发表于 2014-12-13 11:54
额,之前设置在事件人物都用的里面了,不好意思。已修改  发表于 2014-12-13 11:35
按了w的,没有用,什么都按了- -  发表于 2014-12-13 10:48
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
338 小时
注册时间
2014-7-15
帖子
593
9
 楼主| 发表于 2014-12-13 12:31:30 | 只看该作者
本帖最后由 飞火流萤 于 2014-12-13 12:32 编辑

还有个问题是比如这种情况角色从跳台跳跃,根据轻重不同应该落在箭头附近的位置,而事实上如果空白部分没有设置不可通行的时候会落在圆圈处,而设置了不可通行又不能跳跃,除非默认的跳跃距离足够,事实上就是需要类似重力的东西,这个问题能解决吗?

点评

@汪汪  发表于 2014-12-13 12:32
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
10
发表于 2014-12-13 16:24:21 | 只看该作者
额,直接判定太复杂,
我只会用人工代替这种判定。。。。设置会比较麻烦

Project11.zip

204.02 KB, 下载次数: 45

点评

对了,果然解决了,你还是厉害啊,脚本我只能看得懂,写不出  发表于 2014-12-13 16:47
试试这个文件,我重新使用了原有的跳跃脚本。。。水平低。。。脚本冲突很难避免。  发表于 2014-12-13 16:35
我放在楼下了,你看是不是这句$game_party.jump_party_actors(x_plus, y_plus)  发表于 2014-12-13 16:33
我用公共事件里的跳跃做,队伍里的跟随人物是会跳的,但是用你刚才的代码来做,伙伴就不会动了,看来代码里的跳跃对象要更改一下才能一起动  发表于 2014-12-13 16:30

评分

参与人数 1星屑 +200 收起 理由
︶ㄣ牛排ぶ + 200 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-21 15:43

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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