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

Project1

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

如何在真八方走的情况下,显示NPC头上的名字?

 关闭 [复制链接]

Lv3.寻梦者

护国公

梦石
0
星屑
1831
在线时间
2023 小时
注册时间
2005-10-21
帖子
560
跳转到指定楼层
1
发表于 2007-8-14 21:03:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
http://rpg.blue/web/htm/news416.htm
[过期VIP]NPC头上显示名字 更新版

但是这个不能用在真八方走的情况下  请帮偶改改  偶希望能在真八方走里实现这个功能

谢谢鸟~
[IMG][/IMG] ================================== 寂寥宁静雅致之心 ================================== mahoro-matic mirclecompany http://www.mday.com.cn/

Lv3.寻梦者

护国公

梦石
0
星屑
1831
在线时间
2023 小时
注册时间
2005-10-21
帖子
560
2
 楼主| 发表于 2007-8-14 21:03:23 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
http://rpg.blue/web/htm/news416.htm
[过期VIP]NPC头上显示名字 更新版

但是这个不能用在真八方走的情况下  请帮偶改改  偶希望能在真八方走里实现这个功能

谢谢鸟~
[IMG][/IMG] ================================== 寂寥宁静雅致之心 ================================== mahoro-matic mirclecompany http://www.mday.com.cn/

Lv1.梦旅人

看不到我

梦石
0
星屑
50
在线时间
229 小时
注册时间
2005-11-6
帖子
1741

贵宾

3
发表于 2007-8-14 22:27:29 | 只看该作者

  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. ###########################################################################################################################
  5. ###########################################################################################################################
  6. # 脚本功能:八方向走与多帧移动之图片修正__ver1.1。

  7. # 更新日期:2005年8月6日

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

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

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

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

  13. # 图片处理与功能说明:

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

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

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

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

  33. # 作者:carol3
  34. ###########################################################################################################################
  35. ###########################################################################################################################
  36. class Game_Event < Game_Character
  37. def name
  38.    return @event.name
  39. end  
  40. def name=(newname)
  41.    @event.name = newname
  42. end
  43. end
  44. class Game_Player < Game_Character
  45. def name
  46.    return ""
  47. end
  48. end
  49. class Sprite_Character < RPG::Sprite
  50. #--------------------------------------------------------------------------
  51. # ● 定义实例变量
  52. #--------------------------------------------------------------------------
  53. attr_accessor :character                # 角色
  54.    #--------------------------------------------------------------------------
  55. # ● 初始化对像
  56. #     viewport  : 查看端口
  57. #     character : 角色 (Game_Character)
  58. #--------------------------------------------------------------------------
  59. def initialize(viewport, character = nil)
  60.    name = character.name
  61.    super(viewport)
  62.    @character = character
  63.    @namesprite = Sprite.new
  64.    @namesprite.bitmap = Bitmap.new(160, 48)
  65.    @namesprite.bitmap.font.name = "黑体"
  66.    @namesprite.bitmap.font.size = 16
  67.    @namesprite.bitmap.font.color.set(255, 255, 255)
  68.    @evname = name
  69.    @evname_split = name.split(/,/)[0]
  70.    if name[0, 2]=="EV"
  71.      @evname_split = " "
  72.    end
  73.    if name.split(/,/)[1] != nil
  74.      case name.split(/,/)[1]
  75.      when "0"
  76.        @namesprite.bitmap.font.color.set(255, 255, 255)
  77.      when "1"
  78.        @namesprite.bitmap.font.color.set(128, 128, 255)
  79.      when "2"
  80.        @namesprite.bitmap.font.color.set(255, 128, 128)
  81.      when "3"
  82.        @namesprite.bitmap.font.color.set(128, 255, 128)
  83.      when "4"
  84.        @namesprite.bitmap.font.color.set(128, 255, 255)
  85.      when "5"
  86.        @namesprite.bitmap.font.color.set(255, 128, 255)
  87.      when "6"
  88.        @namesprite.bitmap.font.color.set(255, 255, 128)
  89.      when "7"
  90.        @namesprite.bitmap.font.color.set(192, 192, 192)
  91.      else
  92.        @namesprite.bitmap.font.color.set(255, 255, 255)
  93.      end
  94.    end
  95.    if @evname_split != "" and @evname_split != nil
  96.      @namesprite.bitmap.draw_text(0, 0, 160, 36, @evname_split, 1)
  97.    end
  98.    update
  99. end
  100. end
  101. class Game_Player < Game_Character
  102.   if $c3_总共可用的方向数 == 8
  103.     def update
  104.       last_moving = moving?
  105.       unless moving? or $game_system.map_interpreter.running? or
  106.              @move_route_forcing or $game_temp.message_window_showing
  107.         # 用井号后面的东西替代前面的,就可以实现斜4方向走
  108.         case Input.dir8
  109.         when 2
  110.           move_down #move_lower_left
  111.         when 4
  112.           move_left #move_upper_left
  113.         when 6
  114.           move_right #move_lower_right
  115.         when 8
  116.           move_up #move_upper_right
  117.         when 1
  118.           move_lower_left
  119.         when 3
  120.           move_lower_right
  121.         when 7
  122.           move_upper_left
  123.         when 9
  124.           move_upper_right
  125.         end
  126.       end
  127.       # 本地变量记忆坐标
  128.       last_real_x = @real_x
  129.       last_real_y = @real_y
  130.       super
  131.       # 角色向下移动、画面上的位置在中央下方的情况下
  132.       if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  133.         # 画面向下卷动
  134.         $game_map.scroll_down(@real_y - last_real_y)
  135.       end
  136.       # 角色向左移动、画面上的位置在中央左方的情况下
  137.       if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  138.         # 画面向左卷动
  139.         $game_map.scroll_left(last_real_x - @real_x)
  140.       end
  141.       # 角色向右移动、画面上的位置在中央右方的情况下
  142.       if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  143.         # 画面向右卷动
  144.         $game_map.scroll_right(@real_x - last_real_x)
  145.       end
  146.       # 角色向上移动、画面上的位置在中央上方的情况下
  147.       if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  148.         # 画面向上卷动
  149.         $game_map.scroll_up(last_real_y - @real_y)
  150.       end
  151.       # 不在移动中的情况下
  152.       unless moving?
  153.         # 上次主角移动中的情况
  154.         if last_moving
  155.           # 与同位置的事件接触就判定为事件启动
  156.           result = check_event_trigger_here([1,2])
  157.           # 没有可以启动的事件的情况下
  158.           if result == false
  159.             # 调试模式为 ON 并且按下 CTRL 键的情况下除外
  160.             unless $DEBUG and Input.press?(Input::CTRL)
  161.               # 遇敌计数下降
  162.               if @encounter_count > 0
  163.                 @encounter_count -= 1
  164.               end
  165.             end
  166.           end
  167.         end
  168.         # 按下 C 键的情况下
  169.         if Input.trigger?(Input::C)
  170.           # 判定为同位置以及正面的事件启动
  171.           check_event_trigger_here([0])
  172.           check_event_trigger_there([0,1,2])
  173.         end
  174.       end
  175.     end
  176.     #--------------------------------------------------------------------------
  177.     # ● 正面事件的启动判定
  178.     #--------------------------------------------------------------------------
  179.     def check_event_trigger_there(triggers)
  180.       result = false
  181.       # 事件执行中的情况下
  182.       if $game_system.map_interpreter.running?
  183.         return result
  184.       end
  185.       # 计算正面坐标
  186.       new_x = @x
  187.       new_y = @y
  188.       case @direction
  189.       when 1
  190.         new_x -= 1
  191.         new_y += 1
  192.       when 2
  193.         new_y += 1
  194.       when 3
  195.         new_x += 1
  196.         new_y += 1
  197.       when 4
  198.         new_x -= 1
  199.       when 6
  200.         new_x += 1
  201.       when 7
  202.         new_x -= 1
  203.         new_y -= 1
  204.       when 8
  205.         new_y -= 1
  206.       when 9
  207.         new_x += 1
  208.         new_y -= 1
  209.       end
  210.       # 全部事件的循环
  211.       for event in $game_map.events.values
  212.         # 事件坐标与目标一致的情况下
  213.         if event.x == new_x and event.y == new_y and
  214.            triggers.include?(event.trigger)
  215.           # 跳跃中以外的情况下、启动判定是正面的事件
  216.           if not event.jumping? and not event.over_trigger?
  217.             event.start
  218.             result = true
  219.           end
  220.         end
  221.       end
  222.       # 找不到符合条件的事件的情况下
  223.       if result == false
  224.         # 正面的元件是计数器的情况下
  225.         if $game_map.counter?(new_x, new_y)
  226.           # 计算 1 元件里侧的坐标
  227.           new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  228.           new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  229.           # 全事件的循环
  230.           for event in $game_map.events.values
  231.             # 事件坐标与目标一致的情况下
  232.             if event.x == new_x and event.y == new_y and
  233.                triggers.include?(event.trigger)
  234.               # 跳跃中以外的情况下、启动判定是正面的事件
  235.               if not event.jumping? and not event.over_trigger?
  236.                 event.start
  237.                 result = true
  238.               end
  239.             end
  240.           end
  241.         end
  242.       end
  243.       return result
  244.     end
  245.     #--------------------------------------------------------------------------
  246.     # ● 向左下移动
  247.     #--------------------------------------------------------------------------
  248.     def move_lower_left
  249.       # 没有固定面向的场合
  250.       unless @direction_fix
  251.         # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  252.         @direction = 1#(@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
  253.       end
  254.       # 下→左、左→下 的通道可以通行的情况下
  255.       if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
  256.          (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
  257.         # 更新坐标
  258.         @x -= 1
  259.         @y += 1
  260.         # 增加步数
  261.         increase_steps
  262.       else
  263.         check_event_trigger_touch(@x-1, @y+1)
  264.       end
  265.     end
  266.     #--------------------------------------------------------------------------
  267.     # ● 向右下移动
  268.     #--------------------------------------------------------------------------
  269.     def move_lower_right
  270.       # 没有固定面向的场合
  271.       unless @direction_fix
  272.         # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  273.         @direction = 3#(@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
  274.       end
  275.       # 下→右、右→下 的通道可以通行的情况下
  276.       if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
  277.          (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
  278.         # 更新坐标
  279.         @x += 1
  280.         @y += 1
  281.         # 增加步数
  282.         increase_steps
  283.       else
  284.         check_event_trigger_touch(@x+1, @y+1)
  285.       end
  286.     end
  287.     #--------------------------------------------------------------------------
  288.     # ● 向左上移动
  289.     #--------------------------------------------------------------------------
  290.     def move_upper_left
  291.       # 没有固定面向的场合
  292.       unless @direction_fix
  293.         # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  294.         @direction = 7#(@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
  295.       end
  296.       # 上→左、左→上 的通道可以通行的情况下
  297.       if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
  298.          (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
  299.         # 更新坐标
  300.         @x -= 1
  301.         @y -= 1
  302.         # 增加步数
  303.         increase_steps
  304.       else
  305.         check_event_trigger_touch(@x-1, @y-1)
  306.       end
  307.     end
  308.     #--------------------------------------------------------------------------
  309.     # ● 向右上移动
  310.     #--------------------------------------------------------------------------
  311.     def move_upper_right
  312.       # 没有固定面向的场合
  313.       unless @direction_fix
  314.         # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  315.         @direction = 9#(@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
  316.       end
  317.       # 上→右、右→上 的通道可以通行的情况下
  318.       if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
  319.          (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
  320.         # 更新坐标
  321.         @x += 1
  322.         @y -= 1
  323.         # 增加步数
  324.         increase_steps
  325.       else
  326.         check_event_trigger_touch(@x+1, @y-1)
  327.       end
  328.     end
  329.     #--------------------------------------------------------------------------
  330.     # ● 雅土左下移動
  331.     #--------------------------------------------------------------------------
  332.     def move_lower_left_p
  333.       unless @direction_fix
  334.         @direction = 1
  335.       end
  336.       distance = (2 ** @move_speed) / Math.sqrt(2)
  337.       turn_left unless down1(@x, @y, distance)
  338.       turn_down if @event
  339.       turn_down unless left1(@x, @y, distance) unless @event
  340.       turn_left if @event
  341.     end
  342.     #--------------------------------------------------------------------------
  343.     # ● 雅土右下移動
  344.     #--------------------------------------------------------------------------
  345.     def move_lower_right_p
  346.       unless @direction_fix
  347.         @direction = 3
  348.       end
  349.       distance = (2 ** @move_speed) / Math.sqrt(2)
  350.       turn_right unless down1(@x, @y, distance)
  351.       turn_down if @event
  352.       turn_down unless right1(@x, @y, distance) unless @event
  353.       turn_right if @event
  354.     end
  355.     #--------------------------------------------------------------------------
  356.     # ● 雅土左上移動
  357.     #--------------------------------------------------------------------------
  358.     def move_upper_left_p
  359.       unless @direction_fix
  360.         @direction = 7
  361.       end
  362.       distance = (2 ** @move_speed) / Math.sqrt(2)
  363.       turn_left unless up1(@x, @y, distance)
  364.       turn_up if @event
  365.       turn_up unless left1(@x, @y, distance) unless @event
  366.       turn_left if @event
  367.     end
  368.     #--------------------------------------------------------------------------
  369.     # ● 雅土右上移動
  370.     #--------------------------------------------------------------------------
  371.     def move_upper_right_p
  372.       unless @direction_fix
  373.         @direction = 9
  374.       end
  375.       distance = (2 ** @move_speed) / Math.sqrt(2)
  376.       turn_right unless up1(@x, @y, distance)
  377.       turn_up if @event
  378.       turn_up unless right1(@x, @y, distance) unless @event
  379.       turn_right if @event
  380.     end
  381.   end
  382. end


  383. class Sprite_Character < RPG::Sprite
  384.   def update
  385.     super
  386.    if @evname != @character.name
  387.      @namesprite.bitmap.clear
  388.      @evname = @character.name
  389.      @evname_split = @character.name.split(/,/)[0]
  390.      if @character.name.split(/,/)[1] != nil
  391.        case @character.name.split(/,/)[1]
  392.        when "0"
  393.          @namesprite.bitmap.font.color.set(255, 255, 255)
  394.        when "1"
  395.          @namesprite.bitmap.font.color.set(128, 128, 255)
  396.        when "2"
  397.          @namesprite.bitmap.font.color.set(255, 128, 128)
  398.        when "3"
  399.          @namesprite.bitmap.font.color.set(128, 255, 128)
  400.        when "4"
  401.          @namesprite.bitmap.font.color.set(128, 255, 255)
  402.        when "5"
  403.          @namesprite.bitmap.font.color.set(255, 128, 255)
  404.        when "6"
  405.          @namesprite.bitmap.font.color.set(255, 255, 128)
  406.        when "7"
  407.          @namesprite.bitmap.font.color.set(192, 192, 192)
  408.        else
  409.          @namesprite.bitmap.font.color.set(255, 255, 255)
  410.        end
  411.      end
  412.      if @evname_split != "" and @evname_split != nil
  413.        @namesprite.bitmap.draw_text(0, 0, 160, 36, @evname_split, 1)
  414.      end
  415.    end
  416.    @namesprite.x = self.x-80
  417.    @namesprite.y = self.y-self.oy-24
  418.    @namesprite.visible = $game_switches[20]
  419.     # 元件 ID、文件名、色相与现在的情况存在差异的情况下
  420.     if @tile_id != @character.tile_id or
  421.        @character_name != @character.character_name or
  422.        @character_hue != @character.character_hue
  423.       # 记忆元件 ID 与文件名、色相
  424.       @tile_id = @character.tile_id
  425.       @character_name = @character.character_name
  426.       @character_hue = @character.character_hue
  427.       # 元件 ID 为有效值的情况下
  428.       if @tile_id >= 384
  429.         self.bitmap = RPG::Cache.tile($game_map.tileset_name,
  430.           @tile_id, @character.character_hue)
  431.         self.src_rect.set(0, 0, 32, 32)
  432.         self.ox = 16
  433.         self.oy = 32
  434.       # 元件 ID 为无效值的情况下
  435.       else
  436.         self.bitmap = RPG::Cache.character(@character.character_name,
  437.           @character.character_hue)
  438.         @cw = bitmap.width / $c3_每一步的帧数
  439.         if $c3_总共可用的方向数==4
  440.           @ch = bitmap.height / 4
  441.         else
  442.           @ch = bitmap.height / 8
  443.         end
  444.         self.ox = @cw / 2
  445.         self.oy = @ch
  446.       end
  447.     end
  448.     # 设置可视状态
  449.     self.visible = (not @character.transparent)
  450.     # 图形是角色的情况下
  451.     if @tile_id == 0
  452.       # 设置传送目标的矩形
  453.       sx = @character.pattern * @cw
  454.       if $c3_总共可用的方向数==8
  455.         case @character.direction
  456.         when 2
  457.           sy = 0 * @ch
  458.         when 4
  459.           sy = 1 * @ch
  460.         when 6
  461.           sy = 2 * @ch
  462.         when 8
  463.           sy = 3 * @ch
  464.         when 1
  465.           sy = 4 * @ch
  466.         when 3
  467.           sy = 5 * @ch
  468.         when 7
  469.           sy = 6 * @ch
  470.         when 9
  471.           sy = 7 * @ch
  472.         end
  473.       else
  474.         sy = (@character.direction - 2) / 2 * @ch
  475.       end
  476.       self.src_rect.set(sx, sy, @cw, @ch)
  477.     end
  478.     # 设置脚本的坐标
  479.     self.x = @character.screen_x
  480.     self.y = @character.screen_y
  481.     self.z = @character.screen_z(@ch)
  482.     # 设置不透明度、合成方式、茂密
  483.     self.opacity = @character.opacity
  484.     self.blend_type = @character.blend_type
  485.     self.bush_depth = @character.bush_depth
  486.     # 动画
  487.     if @character.animation_id != 0
  488.       animation = $data_animations[@character.animation_id]
  489.       animation(animation, true)
  490.       @character.animation_id = 0
  491.     end
  492.   end
  493. end

  494. class Game_Character
  495.   def c8
  496.     # 随机 0~5 的分支
  497.     case rand(10)
  498.     when 0..3  # 随机
  499.       move_random
  500.     when 4  # 前进一步
  501.       move_forward
  502.     when 5  # 暂时停止
  503.       @stop_count = 0
  504.     when 6..9  #另外4方向随机
  505.       c4
  506.     end
  507.   end
  508.   def c4
  509.     case rand(5)
  510.     when 0
  511.       move_upper_left
  512.     when 1
  513.       move_upper_right
  514.     when 2
  515.       move_lower_left
  516.     when 3
  517.       move_lower_right
  518.     when 4
  519.       @stop_count = 0
  520.     end
  521.   end
  522.       
  523.   def update
  524.     # 跳跃中、移动中、停止中的分支
  525.     if jumping?
  526.       update_jump
  527.     elsif moving?
  528.       update_move
  529.     else
  530.       update_stop
  531.     end
  532.     # 动画计数超过最大值的情况下
  533.     # ※最大值等于基本值减去移动速度 * 1 的值
  534.     if @anime_count > 16*4/$c3_每一步的帧数 - @move_speed * 2
  535.       # 停止动画为 OFF 并且在停止中的情况下
  536.       if not @step_anime and @stop_count > 0
  537.         # 还原为原来的图形
  538.         @pattern = @original_pattern
  539.       # 停止动画为 ON 并且在移动中的情况下
  540.       else
  541.         # 更新图形
  542.         @pattern = (@pattern + 1) % $c3_每一步的帧数
  543.       end
  544.       # 清除动画计数
  545.       @anime_count = 0
  546.     end
  547.     # 等待中的情况下
  548.     if @wait_count > 0
  549.       # 减少等待计数
  550.       @wait_count -= 1
  551.       return
  552.     end
  553.     # 强制移动路线的场合
  554.     if @move_route_forcing
  555.       # 自定义移动
  556.       move_type_custom
  557.       return
  558.     end
  559.     # 事件执行待机中并且为锁定状态的情况下
  560.     if @starting or lock?
  561.       # 不做规则移动
  562.       return
  563.     end
  564.     # 如果停止计数超过了一定的值(由移动频度算出)
  565.     if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
  566.       # 移动类型分支
  567.       case @move_type
  568.       when 1  # 随机
  569.         move_type_random
  570.       when 2  # 接近
  571.         move_type_toward_player
  572.       when 3  # 自定义
  573.         move_type_custom
  574.       end
  575.     end
  576.   end
  577. end

  578. class Window_Base < Window
  579.   def draw_actor_graphic(actor, x, y)
  580.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  581.     cw = bitmap.width / $c3_每一步的帧数
  582.     ch = bitmap.height / $c3_总共可用的方向数
  583.     src_rect = Rect.new(0, 0, cw, ch)
  584.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  585.   end
  586. end

  587. class Game_Character
  588.   #--------------------------------------------------------------------------
  589.   # ● 面向主角的方向
  590.   #--------------------------------------------------------------------------
  591.   def turn_toward_player
  592.     # 求得与主角的坐标差
  593.     sx = @x - $game_player.x
  594.     sy = @y - $game_player.y
  595.     # 坐标相等的场合下
  596.     if sx == 0 and sy == 0
  597.       return
  598.     end
  599.     # 横侧距离长的情况下
  600.     if sx.abs > sy.abs
  601.       # 将左右方向变更为朝向主角的方向
  602.       sx > 0 ? turn_left : turn_right
  603.     # 竖侧距离长的情况下
  604.     else
  605.       # 将上下方向变更为朝向主角的方向
  606.       sy > 0 ? turn_up : turn_down
  607.     end
  608.     if sx == -1 and sy == -1
  609.       @direction = 3
  610.       @stop_count = 0
  611.     elsif sx == -1 and sy == 1
  612.       @direction = 9
  613.       @stop_count = 0
  614.     elsif sx == 1 and sy == -1
  615.       @direction = 1
  616.       @stop_count = 0
  617.     elsif sx == 1 and sy == 1
  618.       @direction = 7
  619.       @stop_count = 0
  620.     end
  621.   end
  622. end

  623. #==============================================================================
  624. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  625. #==============================================================================
复制代码


试试这个可否
控制开关20号 需要修改 搜索$game_switches[20] 修改其他即可
主角需要显示的话
修改
class Game_Player < Game_Character
def name
   return ""
end
end
中""为$game_party.actors[0].name
系统信息:本贴获得楼主认可,66RPG感谢您的热情解答~
回复 支持 反对

使用道具 举报

Lv3.寻梦者

护国公

梦石
0
星屑
1831
在线时间
2023 小时
注册时间
2005-10-21
帖子
560
4
 楼主| 发表于 2007-8-14 23:01:47 | 只看该作者
{/se}{/se}{/se} 谢谢你  偶改好鸟~~ 感谢感谢  {/qiang} {/hx}加分 结帖
[IMG][/IMG] ================================== 寂寥宁静雅致之心 ================================== mahoro-matic mirclecompany http://www.mday.com.cn/
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-27 04:00

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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