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

Project1

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

八方向行走脚本的BUG,帮忙一下

 关闭 [复制链接]
头像被屏蔽

Lv1.梦旅人 (禁止发言)

Zerhom

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-2-8
帖子
287
跳转到指定楼层
1
发表于 2007-8-14 03:12:39 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
头像被屏蔽

Lv1.梦旅人 (禁止发言)

Zerhom

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-2-8
帖子
287
2
 楼主| 发表于 2007-8-14 03:12:39 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2006-12-11
帖子
135
3
发表于 2007-8-14 05:24:20 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

Zerhom

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-2-8
帖子
287
4
 楼主| 发表于 2007-8-14 06:29:33 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv3.寻梦者

昨日的黄昏

梦石
0
星屑
1005
在线时间
937 小时
注册时间
2006-11-5
帖子
4128

第2届短篇游戏比赛季军第3届短篇游戏大赛小游戏及其他组季军

5
发表于 2007-8-14 07:10:26 | 只看该作者
貌似忘记修改NPC的位置了{/gg}

逃跑吧- -
[url=http://weibo.com/2238291690?s=6uyXnP]
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

Zerhom

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-2-8
帖子
287
6
 楼主| 发表于 2007-8-14 07:43:56 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv3.寻梦者

昨日的黄昏

梦石
0
星屑
1005
在线时间
937 小时
注册时间
2006-11-5
帖子
4128

第2届短篇游戏比赛季军第3届短篇游戏大赛小游戏及其他组季军

7
发表于 2007-8-14 07:47:15 | 只看该作者
#--------------------------------------------------------------------------
# ● 面向主角的方向
#--------------------------------------------------------------------------
def turn_toward_player
   # 求得与主角的坐标差
   sx = @x - $game_player.x
   sy = @y - $game_player.y
   # 坐标相等的场合下
   if sx == 0 and sy == 0
     return
   end
   # 横侧距离长的情况下
   if sx.abs > sy.abs
     # 将左右方向变更为朝向主角的方向
     sx > 0 ? turn_left : turn_right
   # 竖侧距离长的情况下
   else
     # 将上下方向变更为朝向主角的方向
     sy > 0 ? turn_up : turn_down
   end
   if sx == -1 and sy == -1
     unless @direction_fix
       @direction = 3
     end
     @stop_count = 0
   elsif sx == -1 and sy == 1
     unless @direction_fix
       @direction = 9
     end
     @stop_count = 0
   elsif sx == 1 and sy == -1
     unless @direction_fix
       @direction = 1
     end
     @stop_count = 0
   elsif sx == 1 and sy == 1
     unless @direction_fix
       @direction = 7
     end
     @stop_count = 0
   end
end
end
#==============================================================================
#==============================================================================


修改这里~~~~~的
@direction = 后的数- -

自己44咯~
[url=http://weibo.com/2238291690?s=6uyXnP]
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

Zerhom

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-2-8
帖子
287
8
 楼主| 发表于 2007-8-14 08:32:40 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

Zerhom

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-2-8
帖子
287
9
 楼主| 发表于 2007-8-14 21:53:23 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
431
在线时间
125 小时
注册时间
2006-11-2
帖子
1200
10
发表于 2007-8-15 03:42:48 | 只看该作者
  1. ###########################################################################################################################
  2. # 脚本功能:八方向走与多帧移动之图片修正 + 人物跟随。

  3. # 更新日期:2007年4月14日

  4. # 修改作者:七夕小雨

  5. # 更新内容:增加斜方向触发,增加斜方向面向角色(1步之内)

  6. # 使用方法:将本脚本插入到main之前。如果你使用了雅土版的八方向走脚本,请确保这个脚本的顺序位置,在雅土八方向走脚本的后面。

  7. # 预先处理:请输入每一步的帧数和总共可用的方向数

  8. $c3_每一步的帧数 = 8
  9. $c3_总共可用的方向数 = 8 #——建议不要修改这个。如果要伪8方向的,就用伪的好了。

  10. # 图片处理与功能说明:
  11. # 1、每一步的帧数:
  12. #    众所周知,RMXP的移动行走图是一个方向共有4帧,很多人都觉得这个帧数有点少。
  13. # 使用这个脚本之后,只要将 $c3_每一步的帧数 这个变量设置一个需要的帧数即可修改
  14. # 单方向移动帧数为相应输入值。修改后,需要用photoshop将所有用到的素材的横排
  15. # 调整为相应帧数,比如输入了8则要将每一行设置8个图像(即每一个行走图有8列)。

  16. # 2、可用方向调整(可用数量:4、8):
  17. #    当为4方向时没有任何变化,还是一个图4行,上左右下4个方向。
  18. #    如果想使用8方向走,将需要八方向行走的行走图在延伸扩大的画布中按照左下、右下、左上、右上继续排布图像。
  19. # 即,行走图图片从上到下的面向排列顺序为:下,左,右,上,左下,右下,左上,右上。
  20. #    至于不需要8方向走的普通的NPC(character),使用photoshop将画布向下扩大一倍即可使用。
  21. #    需要注意的是,如果需要斜方向飞鸟,请不要忘记自制素材。

  22. # 特别提示:   
  23. #     使用本脚本前请先考虑清楚是否要做这种效果。因为使用本脚本后需要用photoshop处理character行走图素材
  24. # 虽然这种处理用photoshop定义动作只需要5分钟即可全部完成,但在制作阶段会感觉不是很爽(具体的用了才知道)
  25. # 作者的建议是,如果你没有足够的制作经验,使用这个脚本得不偿失。请确保自己的能力属于“高手”级别!

  26. # 附赠功能:
  27. #     可以让NPC角色随机8方向走,方法是:NPC角色移动路线为“自定义”,然后自定义里面使用脚本,输入c8即可
  28. #     可以让NPC角色随机4斜角方向走,方法是:NPC角色移动路线为“自定义”,然后自定义里面使用脚本,输入c4即可
  29. #     可以使用真·斜4方向行走,参考脚本53行开始

  30. # 作者:carol3
  31. ###########################################################################################################################
  32. ###########################################################################################################################

  33. class Game_Player < Game_Character
  34. if $c3_总共可用的方向数 == 8
  35.    def update
  36.      last_moving = moving?
  37.      unless moving? or $game_system.map_interpreter.running? or
  38.             @move_route_forcing or $game_temp.message_window_showing
  39.        # 用井号后面的东西替代前面的,就可以实现斜4方向走
  40.        case Input.dir8
  41.        when 2
  42.          move_down #move_lower_left
  43.        when 4
  44.          move_left #move_upper_left
  45.        when 6
  46.          move_right #move_lower_right
  47.        when 8
  48.          move_up #move_upper_right
  49.        when 1
  50.          move_lower_left
  51.        when 3
  52.          move_lower_right
  53.        when 7
  54.          move_upper_left
  55.        when 9
  56.          move_upper_right
  57.        end
  58.      end
  59.      # 本地变量记忆坐标
  60.      last_real_x = @real_x
  61.      last_real_y = @real_y
  62.      super
  63.      # 角色向下移动、画面上的位置在中央下方的情况下
  64.      if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  65.        # 画面向下卷动
  66.        $game_map.scroll_down(@real_y - last_real_y)
  67.      end
  68.      # 角色向左移动、画面上的位置在中央左方的情况下
  69.      if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  70.        # 画面向左卷动
  71.        $game_map.scroll_left(last_real_x - @real_x)
  72.      end
  73.      # 角色向右移动、画面上的位置在中央右方的情况下
  74.      if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  75.        # 画面向右卷动
  76.        $game_map.scroll_right(@real_x - last_real_x)
  77.      end
  78.      # 角色向上移动、画面上的位置在中央上方的情况下
  79.      if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  80.        # 画面向上卷动
  81.        $game_map.scroll_up(last_real_y - @real_y)
  82.      end
  83.      # 不在移动中的情况下
  84.      unless moving?
  85.        # 上次主角移动中的情况
  86.        if last_moving
  87.          # 与同位置的事件接触就判定为事件启动
  88.          result = check_event_trigger_here([1,2])
  89.          # 没有可以启动的事件的情况下
  90.          if result == false
  91.            # 调试模式为 ON 并且按下 CTRL 键的情况下除外
  92.            unless $DEBUG and Input.press?(Input::CTRL)
  93.              # 遇敌计数下降
  94.              if @encounter_count > 0
  95.                @encounter_count -= 1
  96.              end
  97.            end
  98.          end
  99.        end
  100.        # 按下 C 键的情况下
  101.        if Input.trigger?(Input::C)
  102.          # 判定为同位置以及正面的事件启动
  103.          check_event_trigger_here([0])
  104.          check_event_trigger_there([0,1,2])
  105.        end
  106.      end
  107.    end
  108.    #--------------------------------------------------------------------------
  109.    # ● 正面事件的启动判定
  110.    #--------------------------------------------------------------------------
  111.    def check_event_trigger_there(triggers)
  112.      result = false
  113.      # 事件执行中的情况下
  114.      if $game_system.map_interpreter.running?
  115.        return result
  116.      end
  117.      # 计算正面坐标
  118.      new_x = @x
  119.      new_y = @y
  120.      case @direction
  121.      when 8
  122.        new_x -= 1
  123.        new_y += 1
  124.      when 6
  125.        new_y += 1
  126.      when 4
  127.        new_x += 1
  128.        new_y += 1
  129.      when 1
  130.        new_x -= 1
  131.      when 2
  132.        new_x += 1
  133.      when 3
  134.        new_x -= 1
  135.        new_y -= 1
  136.      when 7
  137.        new_y -= 1
  138.      when 9
  139.        new_x += 1
  140.        new_y -= 1
  141.      end
  142.      # 全部事件的循环
  143.      for event in $game_map.events.values
  144.        # 事件坐标与目标一致的情况下
  145.        if event.x == new_x and event.y == new_y and
  146.           triggers.include?(event.trigger)
  147.          # 跳跃中以外的情况下、启动判定是正面的事件
  148.          if not event.jumping? and not event.over_trigger?
  149.            event.start
  150.            result = true
  151.          end
  152.        end
  153.      end
  154.      # 找不到符合条件的事件的情况下
  155.      if result == false
  156.        # 正面的元件是计数器的情况下
  157.        if $game_map.counter?(new_x, new_y)
  158.          # 计算 1 元件里侧的坐标
  159.          new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  160.          new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  161.          # 全事件的循环
  162.          for event in $game_map.events.values
  163.            # 事件坐标与目标一致的情况下
  164.            if event.x == new_x and event.y == new_y and
  165.               triggers.include?(event.trigger)
  166.              # 跳跃中以外的情况下、启动判定是正面的事件
  167.              if not event.jumping? and not event.over_trigger?
  168.                event.start
  169.                result = true
  170.              end
  171.            end
  172.          end
  173.        end
  174.      end
  175.      return result
  176.    end
  177. end
  178. end


  179. class Sprite_Character < RPG::Sprite
  180. def update
  181.    super
  182.    # 元件 ID、文件名、色相与现在的情况存在差异的情况下
  183.    if @tile_id != @character.tile_id or
  184.       @character_name != @character.character_name or
  185.       @character_hue != @character.character_hue
  186.      # 记忆元件 ID 与文件名、色相
  187.      @tile_id = @character.tile_id
  188.      @character_name = @character.character_name
  189.      @character_hue = @character.character_hue
  190.      # 元件 ID 为有效值的情况下
  191.      if @tile_id >= 384
  192.        self.bitmap = RPG::Cache.tile($game_map.tileset_name,
  193.          @tile_id, @character.character_hue)
  194.        self.src_rect.set(0, 0, 32, 32)
  195.        self.ox = 16
  196.        self.oy = 32
  197.      # 元件 ID 为无效值的情况下
  198.      else
  199.        self.bitmap = RPG::Cache.character(@character.character_name,
  200.          @character.character_hue)
  201.        @cw = bitmap.width / $c3_每一步的帧数
  202.        if $c3_总共可用的方向数==4
  203.          @ch = bitmap.height / 4
  204.        else
  205.          @ch = bitmap.height / 8
  206.        end
  207.        self.ox = @cw / 2
  208.        self.oy = @ch
  209.      end
  210.    end
  211.    # 设置可视状态
  212.    self.visible = (not @character.transparent)
  213.    # 图形是角色的情况下
  214.    if @tile_id == 0
  215.      # 设置传送目标的矩形
  216.      sx = @character.pattern * @cw
  217.      if $c3_总共可用的方向数==8
  218.        case @character.direction
  219.        when 2
  220.          sy = 0 * @ch
  221.        when 4
  222.          sy = 1 * @ch
  223.        when 6
  224.          sy = 2 * @ch
  225.        when 8
  226.          sy = 3 * @ch
  227.        when 1
  228.          sy = 4 * @ch
  229.        when 3
  230.          sy = 5 * @ch
  231.        when 7
  232.          sy = 6 * @ch
  233.        when 9
  234.          sy = 7 * @ch
  235.        end
  236.      else
  237.        sy = (@character.direction - 2) / 2 * @ch
  238.      end
  239.      self.src_rect.set(sx, sy, @cw, @ch)
  240.    end
  241.    # 设置脚本的坐标
  242.    self.x = @character.screen_x
  243.    self.y = @character.screen_y
  244.    self.z = @character.screen_z(@ch)
  245.    # 设置不透明度、合成方式、茂密
  246.    self.opacity = @character.opacity
  247.    self.blend_type = @character.blend_type
  248.    self.bush_depth = @character.bush_depth
  249.    # 动画
  250.    if @character.animation_id != 0
  251.      animation = $data_animations[@character.animation_id]
  252.      animation(animation, true)
  253.      @character.animation_id = 0
  254.    end
  255.    #####################################################################

  256.    ####################################################################
  257. end
  258. end

  259. class Game_Character
  260. def c8
  261.    # 随机 0~5 的分支
  262.    case rand(10)
  263.    when 0..3  # 随机
  264.      move_random
  265.    when 4  # 前进一步
  266.      move_forward
  267.    when 5  # 暂时停止
  268.      @stop_count = 0
  269.    when 6..9  #另外4方向随机
  270.      c4
  271.    end
  272. end
  273. def c4
  274.    case rand(5)
  275.    when 0
  276.      move_upper_left
  277.      @direction = 7
  278.    when 1
  279.      move_upper_right
  280.      @direction = 9
  281.    when 2
  282.      move_lower_left
  283.      @direction = 1
  284.    when 3
  285.      move_lower_right
  286.      @direction = 3
  287.    when 4
  288.      @stop_count = 0
  289.    end
  290. end
  291.      
  292. def update
  293.    # 跳跃中、移动中、停止中的分支
  294.    if jumping?
  295.      update_jump
  296.    elsif moving?
  297.      update_move
  298.    else
  299.      update_stop
  300.    end
  301.    # 动画计数超过最大值的情况下
  302.    # ※最大值等于基本值减去移动速度 * 1 的值
  303.    if @anime_count > 16 * 4/$c3_每一步的帧数 - @move_speed # * 2
  304.      # 停止动画为 OFF 并且在停止中的情况下
  305.      if not @step_anime and @stop_count > 0
  306.        # 还原为原来的图形
  307.        @pattern = @original_pattern
  308.      # 停止动画为 ON 并且在移动中的情况下
  309.      else
  310.        # 更新图形
  311.        @pattern = (@pattern + 1) % $c3_每一步的帧数
  312.      end
  313.      # 清除动画计数
  314.      @anime_count = 0
  315.    end
  316.    # 等待中的情况下
  317.    if @wait_count > 0
  318.      # 减少等待计数
  319.      @wait_count -= 1
  320.      return
  321.    end
  322.    # 强制移动路线的场合
  323.    if @move_route_forcing
  324.      # 自定义移动
  325.      move_type_custom
  326.      return
  327.    end
  328.    # 事件执行待机中并且为锁定状态的情况下
  329.    if @starting or lock?
  330.      # 不做规则移动
  331.      return
  332.    end
  333.    # 如果停止计数超过了一定的值(由移动频度算出)
  334.    if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
  335.      # 移动类型分支
  336.      case @move_type
  337.      when 1  # 随机
  338.        move_type_random
  339.      when 2  # 接近
  340.        move_type_toward_player
  341.      when 3  # 自定义
  342.        move_type_custom
  343.      end
  344.    end
  345. end
  346. end

  347. class Window_Base < Window
  348. def draw_actor_graphic(actor, x, y)
  349.    bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  350.    cw = bitmap.width / $c3_每一步的帧数
  351.    ch = bitmap.height / $c3_总共可用的方向数
  352.    src_rect = Rect.new(0, 0, cw, ch)
  353.    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  354. end
  355. end

  356. class Game_Character
  357. #............................................................................
  358.    #--------------------------------------------------------------------------
  359.   # ● 面向向下
  360.   #--------------------------------------------------------------------------
  361.   def turn_down
  362.     unless @direction_fix
  363.       @direction = 6
  364.       @stop_count = 0
  365.     end
  366.   end
  367.   #--------------------------------------------------------------------------
  368.   # ● 面向向左
  369.   #--------------------------------------------------------------------------
  370.   def turn_left
  371.     unless @direction_fix
  372.       @direction = 1
  373.       @stop_count = 0
  374.     end
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # ● 面向向右
  378.   #--------------------------------------------------------------------------
  379.   def turn_right
  380.     unless @direction_fix
  381.       @direction = 2
  382.       @stop_count = 0
  383.     end
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # ● 面向向上
  387.   #--------------------------------------------------------------------------
  388.   def turn_up
  389.     unless @direction_fix
  390.       @direction = 7
  391.       @stop_count = 0
  392.     end
  393.   end

  394.   #--------------------------------------------------------------------------
  395.   # ● 向左下移动
  396.   #--------------------------------------------------------------------------
  397.   def move_lower_left
  398.     # 没有固定面向的场合
  399.     unless @direction_fix
  400.       # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  401.       @direction = 8
  402.     end
  403.     # 下→左、左→下 的通道可以通行的情况下
  404.     if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
  405.        (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
  406.       # 更新坐标
  407.       @x -= 1
  408.       @y += 1
  409.       # 增加步数
  410.       increase_steps
  411.     end
  412.   end
  413.   #--------------------------------------------------------------------------
  414.   # ● 向右下移动
  415.   #--------------------------------------------------------------------------
  416.   def move_lower_right
  417.     # 没有固定面向的场合
  418.     unless @direction_fix
  419.       # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  420.       @direction = 4
  421.     end
  422.     # 下→右、右→下 的通道可以通行的情况下
  423.     if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
  424.        (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
  425.       # 更新坐标
  426.       @x += 1
  427.       @y += 1
  428.       # 增加步数
  429.       increase_steps
  430.     end
  431.   end
  432.   #--------------------------------------------------------------------------
  433.   # ● 向左上移动
  434.   #--------------------------------------------------------------------------
  435.   def move_upper_left
  436.     # 没有固定面向的场合
  437.     unless @direction_fix
  438.       # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  439.       @direction = 3
  440.     end
  441.     # 上→左、左→上 的通道可以通行的情况下
  442.     if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
  443.        (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
  444.       # 更新坐标
  445.       @x -= 1
  446.       @y -= 1
  447.       # 增加步数
  448.       increase_steps
  449.     end
  450.   end
  451.   #--------------------------------------------------------------------------
  452.   # ● 向右上移动
  453.   #--------------------------------------------------------------------------
  454.   def move_upper_right
  455.     # 没有固定面向的场合
  456.     unless @direction_fix
  457.       # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  458.       @direction = 9
  459.     end
  460.     # 上→右、右→上 的通道可以通行的情况下
  461.     if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
  462.        (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
  463.       # 更新坐标
  464.       @x += 1
  465.       @y -= 1
  466.       # 增加步数
  467.       increase_steps
  468.     end
  469.   end
  470. #===============================================================
  471. #----------------------------------------------------------------------------
  472. # ● 寻路移动
  473. #----------------------------------------------------------------------------
  474. def goto(x, y)
  475.    #当操作目标为 角色 时
  476.    trg_x = x
  477.    trg_y = y
  478.    self_x = self.x
  479.    self_y = self.y
  480.    real_self_x = self.screen_x
  481.    real_self_y = self.screen_y
  482.    real_trg_x = x
  483.    real_trg_y = y
  484.    #调用寻路算法,开始计算路线
  485.    @find_path = Find_Path.new
  486.    @path = @find_path.find_short_path(self_x, self_y, trg_x, trg_y,
  487.                           real_self_x, real_self_y, real_trg_x, real_trg_y)
  488.    #开始自动移动,参照本类的 update方法
  489.    @go_path = true
  490.    #自动移动 处理位置初始化
  491.    @path_id = 0
  492. end
  493. #............................................................................
  494. #--------------------------------------------------------------------------
  495. # ● 面向主角的方向
  496. #--------------------------------------------------------------------------
  497. def turn_toward_player
  498.    # 求得与主角的坐标差
  499.    sx = @x - $game_player.x
  500.    sy = @y - $game_player.y
  501.    # 坐标相等的场合下
  502.    if sx == 0 and sy == 0
  503.      return
  504.    end
  505.    # 横侧距离长的情况下
  506.    if sx.abs > sy.abs
  507.      # 将左右方向变更为朝向主角的方向
  508.      sx > 0 ? turn_left : turn_right
  509.    # 竖侧距离长的情况下
  510.    else
  511.      # 将上下方向变更为朝向主角的方向
  512.      sy > 0 ? turn_up : turn_down
  513.    end
  514.    if sx == -1 and sy == -1
  515.      unless @direction_fix
  516.        @direction = 3
  517.      end
  518.      @stop_count = 0
  519.    elsif sx == -1 and sy == 1
  520.      unless @direction_fix
  521.        @direction = 9
  522.      end
  523.      @stop_count = 0
  524.    elsif sx == 1 and sy == -1
  525.      unless @direction_fix
  526.        @direction = 1
  527.      end
  528.      @stop_count = 0
  529.    elsif sx == 1 and sy == 1
  530.      unless @direction_fix
  531.        @direction = 7
  532.      end
  533.      @stop_count = 0
  534.    end
  535. end
  536. end
  537. #==============================================================================
  538. #==============================================================================
复制代码


迁就的改好了,不过接下来你还要面对NPC的朝向问题和未知的其他可能问题

不要为了素材去迁就脚本,反之。

建议是把行走图按照站上脚本的排列方式处理下。




系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
和记忆一起封存着的ID...
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-27 01:18

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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