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

Project1

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

[已经过期] 梦幻群侠传插入XP完整鼠标系统(八方向)V2.0问题

[复制链接]

Lv1.梦旅人

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

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

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

x
本帖最后由 sqing520 于 2014-1-23 12:12 编辑


我在梦幻群侠传里插入了完整鼠标系统(八方向)脚本以后,进入游戏都可以用鼠标,游戏开始后鼠标就没用了,谁知道怎么解决啊?

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2014-1-23
帖子
22
2
 楼主| 发表于 2014-1-23 12:11:45 | 只看该作者
我在梦幻群侠传里插入了完整鼠标系统(八方向)脚本以后,进入游戏都可以用鼠标,游戏开始后鼠标就没用了,谁知道怎么解决啊?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
90
在线时间
308 小时
注册时间
2010-8-10
帖子
794
3
发表于 2014-1-23 12:14:25 | 只看该作者
把工程发出来看看?有些脚本是作者特意修改成为界面可以用 游戏中不能用的。。。。在使用时要看清楚说明
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2014-1-23
帖子
22
4
 楼主| 发表于 2014-1-23 12:18:33 | 只看该作者
不是马甲 发表于 2014-1-23 12:14
把工程发出来看看?有些脚本是作者特意修改成为界面可以用 游戏中不能用的。。。。在使用时要看清楚说明 ...

不会啊,这个脚本单独测试就可以用,放到梦幻群侠传里开头可以,进入游戏就不行了
mouse_8V2.0.rar (502.96 KB, 下载次数: 113)
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2014-1-23
帖子
22
5
 楼主| 发表于 2014-1-23 12:21:16 | 只看该作者
谁知道怎么回事啊
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
90
在线时间
308 小时
注册时间
2010-8-10
帖子
794
6
发表于 2014-1-23 12:22:45 | 只看该作者
sqing520 发表于 2014-1-23 12:18
不会啊,这个脚本单独测试就可以用,放到梦幻群侠传里开头可以,进入游戏就不行了
...

那就是和你的工程中其它脚本有所冲突。可以把工程发上来吗??
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2014-1-23
帖子
22
7
 楼主| 发表于 2014-1-23 12:27:27 | 只看该作者
Game.zip (166 Bytes, 下载次数: 41) 这是工程,鼠标脚本看4楼
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
90
在线时间
308 小时
注册时间
2010-8-10
帖子
794
8
发表于 2014-1-23 12:33:28 | 只看该作者
sqing520 发表于 2014-1-23 12:27
这是工程,鼠标脚本看4楼

工程并不是一个 GAME.rxproj 文件。它包括你的制作游戏必不可少文件。。。。
4楼的截图仅仅是一个文件名。其中并不包括脚本内容。。。。。只给我文件名我是不知道哪出错的
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2014-1-23
帖子
22
9
 楼主| 发表于 2014-1-23 12:38:55 | 只看该作者
不是马甲 发表于 2014-1-23 12:33
工程并不是一个 GAME.rxproj 文件。它包括你的制作游戏必不可少文件。。。。
4楼的截图仅仅是一个文件名 ...

我大概知道冲突出在哪里了,如果删除梦幻群侠传自带的八方向脚本,测试鼠标可控制,但是游戏角色图片在游戏中只能显示一半了
这个是梦幻群侠传自带的八方向脚本
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. ###########################################################################################################################
  5. ###########################################################################################################################
  6. # 脚本功能:八方向走与多帧移动之图片修正__ver1.1。

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

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

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

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

  11. $c3_每一步的帧数 = 4
  12. $c3_总共可用的方向数 = 4 #——建议不要修改这个。如果要伪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_Player < Game_Character
  37.   TIME_LIMIT = 20
  38.   def update
  39.     last_moving = moving?
  40.     unless moving? or $game_system.map_interpreter.running? or
  41.            @move_route_forcing or $game_temp.message_window_showing
  42.       # 用井号后面的东西替代前面的,就可以实现斜4方向走
  43.       case Input.dir8
  44.       when 2
  45.         if $game_switches[2]
  46.           move_down
  47.         else
  48.           move_lower_left
  49.         end            
  50.       when 4
  51.         if $game_switches[2]
  52.           move_left
  53.         else
  54.           move_upper_left
  55.         end
  56.       when 6
  57.         if $game_switches[2]
  58.           move_right
  59.         else
  60.           move_lower_right
  61.         end
  62.       when 8
  63.         if $game_switches[2]
  64.           move_up
  65.         else
  66.           move_upper_right        
  67.         end
  68.       when 1
  69.         move_lower_left
  70.       when 3
  71.         move_lower_right
  72.       when 7
  73.         move_upper_left
  74.       when 9
  75.         move_upper_right
  76.       end
  77.     end
  78.     # 本地变量记忆坐标
  79.     last_real_x = @real_x
  80.     last_real_y = @real_y
  81.     super
  82.     # 角色向下移动、画面上的位置在中央下方的情况下
  83.     if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  84.       # 画面向下卷动
  85.       $game_map.scroll_down(@real_y - last_real_y)
  86.     end
  87.     # 角色向左移动、画面上的位置在中央左方的情况下
  88.     if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  89.       # 画面向左卷动
  90.       $game_map.scroll_left(last_real_x - @real_x)
  91.     end
  92.     # 角色向右移动、画面上的位置在中央右方的情况下
  93.     if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  94.       # 画面向右卷动
  95.       $game_map.scroll_right(@real_x - last_real_x)
  96.     end
  97.     # 角色向上移动、画面上的位置在中央上方的情况下
  98.     if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  99.       # 画面向上卷动
  100.       $game_map.scroll_up(last_real_y - @real_y)
  101.     end
  102.     # 不在移动中的情况下
  103.     unless moving?
  104.       # 上次主角移动中的情况
  105.       if last_moving
  106.         # 与同位置的事件接触就判定为事件启动
  107.         result = check_event_trigger_here([1,2])
  108.         # 没有可以启动的事件的情况下
  109.         if result == false
  110.           # 调试模式为 ON 并且按下 CTRL 键的情况下除外
  111.           unless $DEBUG and Input.press?(Input::CTRL)
  112.             # 遇敌计数下降
  113.             if @encounter_count > 0
  114.               @encounter_count -= 1
  115.             end
  116.           end
  117.         end
  118.       end
  119.       # 按下 C 键的情况下
  120.       if Input.trigger?(Input::C)
  121.         # 判定为同位置以及正面的事件启动
  122.         check_event_trigger_here([0])
  123.         check_event_trigger_there([0,1,2])
  124.       end
  125.     end
  126.   end
  127.   #--------------------------------------------------------------------------
  128.   # ● 正面事件的启动判定
  129.   #--------------------------------------------------------------------------
  130.   def check_event_trigger_there(triggers)
  131.     result = false
  132.     # 事件执行中的情况下
  133.     if $game_system.map_interpreter.running?
  134.       return result
  135.     end
  136.     # 计算正面坐标
  137.     new_x = @x
  138.     new_y = @y
  139.     case @direction
  140.    when 1
  141.       new_x -= 1
  142.       new_y += 1
  143.     when 2
  144.       new_y += 1
  145.     when 3
  146.       new_x += 1
  147.       new_y += 1
  148.     when 4
  149.       new_x -= 1
  150.     when 6
  151.       new_x += 1
  152.     when 7
  153.       new_x -= 1
  154.       new_y -= 1
  155.     when 8
  156.       new_y -= 1
  157.     when 9
  158.       new_x += 1
  159.       new_y -= 1
  160.     end
  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.     # 找不到符合条件的事件的情况下
  174.     if result == false
  175.       # 正面的元件是计数器的情况下
  176.       if $game_map.counter?(new_x, new_y)
  177.         # 计算 1 元件里侧的坐标
  178.         new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  179.         new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  180.         # 全事件的循环
  181.         for event in $game_map.events.values
  182.           # 事件坐标与目标一致的情况下
  183.           if event.x == new_x and event.y == new_y and
  184.              triggers.include?(event.trigger)
  185.             # 跳跃中以外的情况下、启动判定是正面的事件
  186.             if not event.jumping? and not event.over_trigger?
  187.               event.start
  188.               result = true
  189.             end
  190.           end
  191.         end
  192.       end
  193.     end
  194.     return result
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ● 向左下移动
  198.   #--------------------------------------------------------------------------
  199.   def move_lower_left
  200.     # 没有固定面向的场合
  201.     unless @direction_fix
  202.       # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  203.       @direction = 3#(@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
  204.     end
  205.     # 下→左、左→下 的通道可以通行的情况下
  206.     if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
  207.        (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
  208.       # 更新坐标
  209.       @x -= 1
  210.       @y += 1
  211.       # 增加步数
  212.       increase_steps
  213.     else
  214.       check_event_trigger_touch(@x-1, @y+1)
  215.     end
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 向右下移动
  219.   #--------------------------------------------------------------------------
  220.   def move_lower_right
  221.     # 没有固定面向的场合
  222.     unless @direction_fix
  223.       # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  224.       @direction = 9#(@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
  225.     end
  226.     # 下→右、右→下 的通道可以通行的情况下
  227.     if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
  228.        (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
  229.       # 更新坐标
  230.       @x += 1
  231.       @y += 1
  232.       # 增加步数
  233.       increase_steps
  234.     else
  235.       check_event_trigger_touch(@x+1, @y+1)
  236.     end
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● 向左上移动
  240.   #--------------------------------------------------------------------------
  241.   def move_upper_left
  242.     # 没有固定面向的场合
  243.     unless @direction_fix
  244.       # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  245.       @direction = 7#(@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
  246.     end
  247.     # 上→左、左→上 的通道可以通行的情况下
  248.     if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
  249.        (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
  250.       # 更新坐标
  251.       @x -= 1
  252.       @y -= 1
  253.       # 增加步数
  254.       increase_steps
  255.     else
  256.       check_event_trigger_touch(@x-1, @y-1)
  257.     end
  258.   end
  259.   #--------------------------------------------------------------------------
  260.   # ● 向右上移动
  261.   #--------------------------------------------------------------------------
  262.   def move_upper_right
  263.     # 没有固定面向的场合
  264.     unless @direction_fix
  265.       # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  266.       @direction = 1#(@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
  267.     end
  268.     # 上→右、右→上 的通道可以通行的情况下
  269.     if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
  270.        (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
  271.       # 更新坐标
  272.       @x += 1
  273.       @y -= 1
  274.       # 增加步数
  275.       increase_steps
  276.     else
  277.       check_event_trigger_touch(@x+1, @y-1)
  278.     end
  279.   end
  280. end


  281. class Sprite_Character < RPG::Sprite
  282.   def update
  283.     super
  284.     # 元件 ID、文件名、色相与现在的情况存在差异的情况下
  285.     if @tile_id != @character.tile_id or
  286.        @character_name != @character.character_name or
  287.        @character_hue != @character.character_hue
  288.       # 记忆元件 ID 与文件名、色相
  289.       @tile_id = @character.tile_id
  290.       @character_name = @character.character_name
  291.       @character_hue = @character.character_hue
  292.       # 元件 ID 为有效值的情况下
  293.       if @tile_id >= 384
  294.         self.bitmap = RPG::Cache.tile($game_map.tileset_name,
  295.           @tile_id, @character.character_hue)
  296.         self.src_rect.set(0, 0, 32, 32)
  297.         self.ox = 16
  298.         self.oy = 32
  299.       # 元件 ID 为无效值的情况下
  300.       else
  301.         self.bitmap = RPG::Cache.character(@character.character_name,
  302.           @character.character_hue)
  303.         @cw = bitmap.width / $c3_每一步的帧数
  304.           @ch = bitmap.height / 4
  305.         self.ox = @cw / 2
  306.         self.oy = @ch
  307.       end
  308.     end
  309.     # 设置可视状态
  310.     self.visible = (not @character.transparent)
  311.     # 图形是角色的情况下
  312.     if @tile_id == 0
  313.       # 设置传送目标的矩形
  314.       sx = @character.pattern * @cw
  315.         case @character.direction
  316.         when 2
  317.           sy = 0 * @ch
  318.         when 4
  319.           sy = 1 * @ch
  320.         when 6
  321.           sy = 2 * @ch
  322.         when 8
  323.           sy = 3 * @ch
  324.         when 1
  325.           sy = 2 * @ch
  326.         when 3
  327.           sy = 1 * @ch
  328.         when 7
  329.           sy = 3 * @ch
  330.         when 9
  331.           sy = 0 * @ch
  332.         end
  333.       self.src_rect.set(sx, sy, @cw, @ch)
  334.     end
  335.     # 设置脚本的坐标
  336.     self.x = @character.screen_x
  337.     self.y = @character.screen_y
  338.     self.z = @character.screen_z(@ch)
  339.     # 设置不透明度、合成方式、茂密
  340.     self.opacity = @character.opacity
  341.     self.blend_type = @character.blend_type
  342.     self.bush_depth = @character.bush_depth
  343.     # 动画
  344.     if @character.animation_id != 0
  345.       animation = $data_animations[@character.animation_id]
  346.       animation(animation, true)
  347.       @character.animation_id = 0
  348.     end
  349.   end
  350. end

  351. class Game_Character
  352.   attr_accessor :time
  353.   #--------------------------------------------------------------------------
  354.   # ● 初始化对像
  355.   #--------------------------------------------------------------------------
  356.   alias old_ini initialize
  357.   def initialize
  358.     old_ini
  359.     [url=home.php?mod=space&uid=134219]@Time[/url] = 0
  360.   end
  361.   def c8
  362.     # 随机 0~5 的分支
  363.     case rand(10)
  364.     when 0..3  # 随机
  365.       move_random
  366.     when 4  # 前进一步
  367.       move_forward
  368.     when 5  # 暂时停止
  369.       @stop_count = 0
  370.     when 6..9  #另外4方向随机
  371.       c4
  372.     end
  373.   end
  374.   def c4
  375.     case rand(5)
  376.     when 0
  377.       move_upper_left
  378.     when 1
  379.       move_upper_right
  380.     when 2
  381.       move_lower_left
  382.     when 3
  383.       move_lower_right
  384.     when 4
  385.       @stop_count = 0
  386.     end
  387.   end
  388.       
  389.   def update
  390.     # 跳跃中、移动中、停止中的分支
  391.     if jumping?
  392.       update_jump
  393.     elsif moving?
  394.       update_move
  395.     else
  396.       update_stop
  397.     end
  398.     # 动画计数超过最大值的情况下
  399.     # ※最大值等于基本值减去移动速度 * 1 的值
  400.     if @anime_count > 16*4/$c3_每一步的帧数 - @move_speed * 2  
  401.       # 停止动画为 OFF 并且在停止中的情况下
  402.       if not @step_anime and @stop_count > 0
  403.         # 还原为原来的图形
  404.         @pattern = @original_pattern
  405.       # 停止动画为 ON 并且在移动中的情况下
  406.       else
  407.         # 更新图形
  408.         @pattern = (@pattern + 1) % $c3_每一步的帧数
  409.       end
  410.       # 清除动画计数
  411.       @anime_count = 0
  412.     end
  413.     # 等待中的情况下
  414.     if @wait_count > 0
  415.       # 减少等待计数
  416.       @wait_count -= 0
  417.       return
  418.     end
  419.     # 强制移动路线的场合
  420.     if @move_route_forcing
  421.       # 自定义移动
  422.       move_type_custom
  423.       return
  424.     end
  425.     # 事件执行待机中并且为锁定状态的情况下
  426.     if @starting or lock?
  427.       # 不做规则移动
  428.       return
  429.     end
  430.     # 如果停止计数超过了一定的值(由移动频度算出)
  431.     if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
  432.       # 移动类型分支
  433.       case @move_type
  434.       when 1  # 随机
  435.         move_type_random
  436.       when 2  # 接近
  437.         move_type_toward_player
  438.       when 3  # 自定义
  439.         move_type_custom
  440.       end
  441.     end
  442.   end
  443. end

  444. class Window_Base < Window
  445.   def draw_actor_graphic(actor, x, y)
  446.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  447.     cw = bitmap.width / $c3_每一步的帧数
  448.     ch = bitmap.height / $c3_总共可用的方向数
  449.     src_rect = Rect.new(0, 0, cw, ch)
  450.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  451.   end
  452. end

  453. class Game_Character
  454.   #--------------------------------------------------------------------------
  455.   # ● 面向主角的方向
  456.   #--------------------------------------------------------------------------
  457.   def turn_toward_player
  458.     # 求得与主角的坐标差
  459.     sx = @x - $game_player.x
  460.     sy = @y - $game_player.y
  461.     # 坐标相等的场合下
  462.     if sx == 0 and sy == 0
  463.       return
  464.     end
  465.     # 横侧距离长的情况下
  466.     if sx.abs > sy.abs
  467.       # 将左右方向变更为朝向主角的方向
  468.       sx > 0 ? turn_left : turn_right
  469.     # 竖侧距离长的情况下
  470.     else
  471.       # 将上下方向变更为朝向主角的方向
  472.       sy > 0 ? turn_up : turn_down
  473.     end
  474.     if sx == -1 and sy == -1
  475.       @direction = 9
  476.       @stop_count = 0
  477.     elsif sx == -1 and sy == 1
  478.       @direction = 1
  479.       @stop_count = 0
  480.     elsif sx == 1 and sy == -1
  481.       @direction = 3
  482.       @stop_count = 0
  483.     elsif sx == 1 and sy == 1
  484.       @direction = 7
  485.       @stop_count = 0
  486.     end
  487.   end
  488. end

  489. #==============================================================================
  490. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  491. #==============================================================================
复制代码
这段是鼠标控制八向脚本
  1. ###########################################################################################################################
  2. # 脚本功能:八方向走与多帧移动之图片修正 + 人物跟随。

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

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

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

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

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

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

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

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

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

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

  29. # 作者:carol3
  30. ###########################################################################################################################
  31. ###########################################################################################################################
  32. class Game_Character
  33.   def event_is_in?(x, y)
  34.     for event in $game_map.events.values
  35.       # 事件坐标与目标一致的情况下
  36.       if event.x == x and event.y == y
  37.         # 跳跃中以外的情况下、启动判定是同位置的事件
  38.         return true
  39.       end
  40.     end
  41.     return false
  42.   end
  43.   def player_is_in?(x, y)
  44.     if $game_player.x == x and $game_player.y == y
  45.       return true
  46.     end
  47.     return false
  48.   end
  49.   def can_go?(x, y)
  50.     if player_is_in?(x, y) or event_is_in?(x, y)
  51.       return false
  52.     else
  53.       return true
  54.     end
  55.   end
  56.   #--------------------------------------------------------------------------
  57.   # ● 向下移动
  58.   #     turn_enabled : 本场地位置更改许可标志
  59.   #--------------------------------------------------------------------------
  60.   def move_down(turn_enabled = true)
  61.     # 面向下
  62.     if turn_enabled
  63.       turn_down
  64.     end
  65.     # 可以通行的场合
  66.     if passable?(@x, @y, 2)
  67.       # 面向下
  68.       turn_down
  69.       # 更新坐标
  70.       @y += 1
  71.       # 增加步数
  72.       increase_steps
  73.     #..........................................................................
  74.     elsif passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::DOWN) and
  75.           can_go?(@x, @y + 1)
  76.       unless @direction_fix
  77.         @direction = 1
  78.       end
  79.       @x -= 1
  80.       @y += 1
  81.       increase_steps
  82.     elsif passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::DOWN) and
  83.           can_go?(@x, @y + 1)
  84.       unless @direction_fix
  85.         @direction = 3
  86.       end
  87.       @x += 1
  88.       @y += 1
  89.       increase_steps
  90.     #..........................................................................
  91.     # 不能通行的情况下
  92.     else
  93.       # 接触事件的启动判定
  94.       check_event_trigger_touch(@x, @y+1)
  95.     end
  96.   end
  97.   #--------------------------------------------------------------------------
  98.   # ● 向左移动
  99.   #     turn_enabled : 本场地位置更改许可标志
  100.   #--------------------------------------------------------------------------
  101.   def move_left(turn_enabled = true)
  102.     # 面向左
  103.     if turn_enabled
  104.       turn_left
  105.     end
  106.     # 可以通行的情况下
  107.     if passable?(@x, @y, 4)
  108.       # 面向左
  109.       turn_left
  110.       # 更新坐标
  111.       @x -= 1
  112.       # 增加步数
  113.       increase_steps
  114.     #..........................................................................
  115.     elsif passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::LEFT) and
  116.           can_go?(@x - 1, @y)
  117.       unless @direction_fix
  118.         @direction = 7
  119.       end
  120.       @x -= 1
  121.       @y -= 1
  122.       increase_steps
  123.     elsif passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::LEFT) and
  124.           can_go?(@x - 1, @y)
  125.       unless @direction_fix
  126.         @direction = 1
  127.       end
  128.       @x -= 1
  129.       @y += 1
  130.       increase_steps
  131.     #..........................................................................
  132.     # 不能通行的情况下
  133.     else
  134.       # 接触事件的启动判定
  135.       check_event_trigger_touch(@x-1, @y)
  136.     end
  137.   end
  138.   #--------------------------------------------------------------------------
  139.   # ● 向右移动
  140.   #     turn_enabled : 本场地位置更改许可标志
  141.   #--------------------------------------------------------------------------
  142.   def move_right(turn_enabled = true)
  143.     # 面向右
  144.     if turn_enabled
  145.       turn_right
  146.     end
  147.     # 可以通行的场合
  148.     if passable?(@x, @y, 6)
  149.       # 面向右
  150.       turn_right
  151.       # 更新坐标
  152.       @x += 1
  153.       # 增加部数
  154.       increase_steps
  155.     #..........................................................................
  156.     elsif passable?(@x, @y, Input::UP) and passable?(@x, @y - 1, Input::RIGHT) and
  157.           can_go?(@x + 1, @y)
  158.       unless @direction_fix
  159.         @direction = 9
  160.       end
  161.       @x += 1
  162.       @y -= 1
  163.       increase_steps
  164.     elsif passable?(@x, @y, Input::DOWN) and passable?(@x, @y + 1, Input::RIGHT) and
  165.           can_go?(@x + 1, @y)
  166.       unless @direction_fix
  167.         @direction = 3
  168.       end
  169.       @x += 1
  170.       @y += 1
  171.       increase_steps
  172.     #..........................................................................
  173.     # 不能通行的情况下
  174.     else
  175.       # 接触事件的启动判定
  176.       check_event_trigger_touch(@x+1, @y)
  177.     end
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 向上移动
  181.   #     turn_enabled : 本场地位置更改许可标志
  182.   #--------------------------------------------------------------------------
  183.   def move_up(turn_enabled = true)
  184.     # 面向上
  185.     if turn_enabled
  186.       turn_up
  187.     end
  188.     # 可以通行的情况下
  189.     if passable?(@x, @y, 8)
  190.       # 面向上
  191.       turn_up
  192.       # 更新坐标
  193.       @y -= 1
  194.       # 歩数増加
  195.       increase_steps
  196.     #..........................................................................
  197.     elsif passable?(@x, @y, Input::LEFT) and passable?(@x - 1, @y, Input::UP) and
  198.           can_go?(@x, @y - 1)
  199.       unless @direction_fix
  200.         @direction = 7
  201.       end
  202.       @x -= 1
  203.       @y -= 1
  204.       increase_steps
  205.     elsif passable?(@x, @y, Input::RIGHT) and passable?(@x + 1, @y, Input::UP) and
  206.           can_go?(@x, @y - 1)
  207.       unless @direction_fix
  208.         @direction = 9
  209.       end
  210.       @x += 1
  211.       @y -= 1
  212.       increase_steps
  213.     #..........................................................................
  214.     # 不能通行的情况下
  215.     else
  216.       # 接触事件的启动判定
  217.       check_event_trigger_touch(@x, @y-1)
  218.     end
  219.   end
  220.   #--------------------------------------------------------------------------
  221.   # ● 向左下移动
  222.   #--------------------------------------------------------------------------
  223.   def move_lower_left
  224.     # 没有固定面向的场合
  225.     unless @direction_fix
  226.       # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  227.       @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
  228.     end
  229.     # 下→左、左→下 的通道可以通行的情况下
  230.     if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
  231.        (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
  232.       # 更新坐标
  233.       @x -= 1
  234.       @y += 1
  235.       # 增加步数
  236.       increase_steps
  237.     #..........................................................................
  238.     elsif passable?(@x, @y, Input::DOWN) and can_go?(@x - 1, @y + 1)
  239.       unless @direction_fix
  240.         @direction = 2
  241.       end
  242.       @y += 1
  243.       increase_steps
  244.     elsif passable?(@x, @y, Input::LEFT) and can_go?(@x - 1, @y + 1)
  245.       unless @direction_fix
  246.         @direction = 4
  247.       end
  248.       @x -= 1
  249.       increase_steps
  250.     #..........................................................................
  251.     end
  252.   end
  253.   #--------------------------------------------------------------------------
  254.   # ● 向右下移动
  255.   #--------------------------------------------------------------------------
  256.   def move_lower_right
  257.     # 没有固定面向的场合
  258.     unless @direction_fix
  259.       # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  260.       @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
  261.     end
  262.     # 下→右、右→下 的通道可以通行的情况下
  263.     if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
  264.        (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
  265.       # 更新坐标
  266.       @x += 1
  267.       @y += 1
  268.       # 增加步数
  269.       increase_steps
  270.     elsif passable?(@x, @y, Input::DOWN) and can_go?(@x + 1, @y + 1)
  271.       unless @direction_fix
  272.         @direction = 2
  273.       end
  274.       @y += 1
  275.       increase_steps
  276.     elsif passable?(@x, @y, Input::RIGHT) and can_go?(@x + 1, @y + 1)
  277.       unless @direction_fix
  278.         @direction = 6
  279.       end
  280.       @x += 1
  281.       increase_steps
  282.     end
  283.   end
  284.   #--------------------------------------------------------------------------
  285.   # ● 向左上移动
  286.   #--------------------------------------------------------------------------
  287.   def move_upper_left
  288.     # 没有固定面向的场合
  289.     unless @direction_fix
  290.       # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  291.       @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
  292.     end
  293.     # 上→左、左→上 的通道可以通行的情况下
  294.     if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
  295.        (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
  296.       # 更新坐标
  297.       @x -= 1
  298.       @y -= 1
  299.       # 增加步数
  300.       increase_steps
  301.     #..........................................................................
  302.     elsif passable?(@x, @y, Input::UP) and can_go?(@x - 1, @y - 1)
  303.       unless @direction_fix
  304.         @direction = 8
  305.       end
  306.       @y -= 1
  307.       increase_steps
  308.     elsif passable?(@x, @y, Input::LEFT) and can_go?(@x - 1, @y - 1)
  309.       unless @direction_fix
  310.         @direction = 4
  311.       end
  312.       @x -= 1
  313.       increase_steps
  314.     #..........................................................................
  315.     end
  316.   end
  317.   #--------------------------------------------------------------------------
  318.   # ● 向右上移动
  319.   #--------------------------------------------------------------------------
  320.   def move_upper_right
  321.     # 没有固定面向的场合
  322.     unless @direction_fix
  323.       # 朝向是右的情况下适合的面是左面、朝向是上的情况下适合的面是下面
  324.       @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
  325.     end
  326.     # 上→右、右→上 的通道可以通行的情况下
  327.     if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
  328.        (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
  329.       # 更新坐标
  330.       @x += 1
  331.       @y -= 1
  332.       # 增加步数
  333.       increase_steps
  334.     #..........................................................................
  335.     elsif passable?(@x, @y, Input::UP) and can_go?(@x + 1, @y - 1)
  336.       unless @direction_fix
  337.         @direction = 8
  338.       end
  339.       @y -= 1
  340.       increase_steps
  341.     elsif passable?(@x, @y, Input::RIGHT) and can_go?(@x + 1, @y - 1)
  342.       unless @direction_fix
  343.         @direction = 6
  344.       end
  345.       @x += 1
  346.       increase_steps
  347.     #..........................................................................
  348.     end
  349.   end
  350. end



  351. class Game_Player < Game_Character
  352. if $c3_总共可用的方向数 == 8
  353.    def update
  354.      last_moving = moving?
  355.      unless moving? or $game_system.map_interpreter.running? or
  356.             @move_route_forcing or $game_temp.message_window_showing
  357.        # 用井号后面的东西替代前面的,就可以实现斜4方向走
  358.        case Input.dir8
  359.        when 2
  360.          move_down #move_lower_left
  361.        when 4
  362.          move_left #move_upper_left
  363.        when 6
  364.          move_right #move_lower_right
  365.        when 8
  366.          move_up #move_upper_right
  367.        when 1
  368.          move_lower_left
  369.        when 3
  370.          move_lower_right
  371.        when 7
  372.          move_upper_left
  373.        when 9
  374.          move_upper_right
  375.        end
  376.      end
  377.      # 本地变量记忆坐标
  378.      last_real_x = @real_x
  379.      last_real_y = @real_y
  380.      super
  381.      # 角色向下移动、画面上的位置在中央下方的情况下
  382.      if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  383.        # 画面向下卷动
  384.        $game_map.scroll_down(@real_y - last_real_y)
  385.      end
  386.      # 角色向左移动、画面上的位置在中央左方的情况下
  387.      if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  388.        # 画面向左卷动
  389.        $game_map.scroll_left(last_real_x - @real_x)
  390.      end
  391.      # 角色向右移动、画面上的位置在中央右方的情况下
  392.      if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  393.        # 画面向右卷动
  394.        $game_map.scroll_right(@real_x - last_real_x)
  395.      end
  396.      # 角色向上移动、画面上的位置在中央上方的情况下
  397.      if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  398.        # 画面向上卷动
  399.        $game_map.scroll_up(last_real_y - @real_y)
  400.      end
  401.      # 不在移动中的情况下
  402.      unless moving?
  403.        # 上次主角移动中的情况
  404.        if last_moving
  405.          # 与同位置的事件接触就判定为事件启动
  406.          result = check_event_trigger_here([1,2])
  407.          # 没有可以启动的事件的情况下
  408.          if result == false
  409.            # 调试模式为 ON 并且按下 CTRL 键的情况下除外
  410.            unless $DEBUG and Input.press?(Input::CTRL)
  411.              # 遇敌计数下降
  412.              if @encounter_count > 0
  413.                @encounter_count -= 1
  414.              end
  415.            end
  416.          end
  417.        end
  418.        # 按下 C 键的情况下
  419.        if Input.trigger?(Input::C)
  420.          # 判定为同位置以及正面的事件启动
  421.          check_event_trigger_here([0])
  422.          check_event_trigger_there([0,1,2])
  423.        end
  424.      end
  425.    end
  426.    #--------------------------------------------------------------------------
  427.    # ● 正面事件的启动判定
  428.    #--------------------------------------------------------------------------
  429.    def check_event_trigger_there(triggers)
  430.      result = false
  431.      # 事件执行中的情况下
  432.      if $game_system.map_interpreter.running?
  433.        return result
  434.      end
  435.      # 计算正面坐标
  436.      new_x = @x
  437.      new_y = @y
  438.      case @direction
  439.      when 1
  440.        new_x -= 1
  441.        new_y += 1
  442.      when 2
  443.        new_y += 1
  444.      when 3
  445.        new_x += 1
  446.        new_y += 1
  447.      when 4
  448.        new_x -= 1
  449.      when 6
  450.        new_x += 1
  451.      when 7
  452.        new_x -= 1
  453.        new_y -= 1
  454.      when 8
  455.        new_y -= 1
  456.      when 9
  457.        new_x += 1
  458.        new_y -= 1
  459.      end
  460.      # 全部事件的循环
  461.      for event in $game_map.events.values
  462.        # 事件坐标与目标一致的情况下
  463.        if event.x == new_x and event.y == new_y and
  464.           triggers.include?(event.trigger)
  465.          # 跳跃中以外的情况下、启动判定是正面的事件
  466.          if not event.jumping? and not event.over_trigger?
  467.            event.start
  468.            result = true
  469.          end
  470.        end
  471.      end
  472.      # 找不到符合条件的事件的情况下
  473.      if result == false
  474.        # 正面的元件是计数器的情况下
  475.        if $game_map.counter?(new_x, new_y)
  476.          # 计算 1 元件里侧的坐标
  477.          new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  478.          new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  479.          # 全事件的循环
  480.          for event in $game_map.events.values
  481.            # 事件坐标与目标一致的情况下
  482.            if event.x == new_x and event.y == new_y and
  483.               triggers.include?(event.trigger)
  484.              # 跳跃中以外的情况下、启动判定是正面的事件
  485.              if not event.jumping? and not event.over_trigger?
  486.                event.start
  487.                result = true
  488.              end
  489.            end
  490.          end
  491.        end
  492.      end
  493.      return result
  494.    end
  495. end
  496. end


  497. class Sprite_Character < RPG::Sprite
  498. def update
  499.    super
  500.    # 元件 ID、文件名、色相与现在的情况存在差异的情况下
  501.    if @tile_id != @character.tile_id or
  502.       @character_name != @character.character_name or
  503.       @character_hue != @character.character_hue
  504.      # 记忆元件 ID 与文件名、色相
  505.      @tile_id = @character.tile_id
  506.      @character_name = @character.character_name
  507.      @character_hue = @character.character_hue
  508.      # 元件 ID 为有效值的情况下
  509.      if @tile_id >= 384
  510.        self.bitmap = RPG::Cache.tile($game_map.tileset_name,
  511.          @tile_id, @character.character_hue)
  512.        self.src_rect.set(0, 0, 32, 32)
  513.        self.ox = 16
  514.        self.oy = 32
  515.      # 元件 ID 为无效值的情况下
  516.      else
  517.        self.bitmap = RPG::Cache.character(@character.character_name,
  518.          @character.character_hue)
  519.        @cw = bitmap.width / $c3_每一步的帧数
  520.        if $c3_总共可用的方向数==4
  521.          @ch = bitmap.height / 4
  522.        else
  523.          @ch = bitmap.height / 8
  524.        end
  525.        self.ox = @cw / 2
  526.        self.oy = @ch
  527.      end
  528.    end
  529.    # 设置可视状态
  530.    self.visible = (not @character.transparent)
  531.    # 图形是角色的情况下
  532.    if @tile_id == 0
  533.      # 设置传送目标的矩形
  534.      sx = @character.pattern * @cw
  535.      if $c3_总共可用的方向数==8
  536.        case @character.direction
  537.        when 2
  538.          sy = 0 * @ch
  539.        when 4
  540.          sy = 1 * @ch
  541.        when 6
  542.          sy = 2 * @ch
  543.        when 8
  544.          sy = 3 * @ch
  545.        when 1
  546.          sy = 4 * @ch
  547.        when 3
  548.          sy = 5 * @ch
  549.        when 7
  550.          sy = 6 * @ch
  551.        when 9
  552.          sy = 7 * @ch
  553.        end
  554.      else
  555.        sy = (@character.direction - 2) / 2 * @ch
  556.      end
  557.      self.src_rect.set(sx, sy, @cw, @ch)
  558.    end
  559.    # 设置脚本的坐标
  560.    self.x = @character.screen_x
  561.    self.y = @character.screen_y
  562.    self.z = @character.screen_z(@ch)
  563.    # 设置不透明度、合成方式、茂密
  564.    self.opacity = @character.opacity
  565.    self.blend_type = @character.blend_type
  566.    self.bush_depth = @character.bush_depth
  567.    # 动画
  568.    if @character.animation_id != 0
  569.      animation = $data_animations[@character.animation_id]
  570.      animation(animation, true)
  571.      @character.animation_id = 0
  572.    end
  573.    #####################################################################
  574.    #id = $game_map.map_id
  575.    #name = $data_mapinfos[id].name
  576.    #if name.include?("★")
  577.    #  rage = name.split(/★/)[1]
  578.    #  min_rate = rage.split(/~/)[0].to_f
  579.    #  max_rate = rage.split(/~/)[1].to_f
  580.    #  rate =  min_rate + (@character.y.to_f / $game_map.height.to_f * (max_rate - min_rate))
  581.    #  self.zoom_x = self.zoom_y = rate
  582.    #  if @character.character_name.include?("★★")
  583.    #    self.zoom_x = self.zoom_y = 1
  584.    #  end
  585.    #end
  586.    ####################################################################
  587. end
  588. end

  589. class Game_Character
  590. def c8
  591.    # 随机 0~5 的分支
  592.    case rand(10)
  593.    when 0..3  # 随机
  594.      move_random
  595.    when 4  # 前进一步
  596.      move_forward
  597.    when 5  # 暂时停止
  598.      @stop_count = 0
  599.    when 6..9  #另外4方向随机
  600.      c4
  601.    end
  602. end
  603. def c4
  604.    case rand(5)
  605.    when 0
  606.      move_upper_left
  607.      @direction = 7
  608.    when 1
  609.      move_upper_right
  610.      @direction = 9
  611.    when 2
  612.      move_lower_left
  613.      @direction = 1
  614.    when 3
  615.      move_lower_right
  616.      @direction = 3
  617.    when 4
  618.      @stop_count = 0
  619.    end
  620. end
  621.      
  622. def update
  623.    # 跳跃中、移动中、停止中的分支
  624.    if jumping?
  625.      update_jump
  626.    elsif moving?
  627.      update_move
  628.    else
  629.      update_stop
  630.    end
  631.    # 动画计数超过最大值的情况下
  632.    # ※最大值等于基本值减去移动速度 * 1 的值
  633.    if @anime_count > 16 * 4/$c3_每一步的帧数 - @move_speed  * 2
  634.      # 停止动画为 OFF 并且在停止中的情况下
  635.      if not @step_anime and @stop_count > 0
  636.        # 还原为原来的图形
  637.        @pattern = @original_pattern
  638.      # 停止动画为 ON 并且在移动中的情况下
  639.      else
  640.        # 更新图形
  641.        @pattern = (@pattern + 1) % $c3_每一步的帧数
  642.      end
  643.      # 清除动画计数
  644.      @anime_count = 0
  645.    end
  646.    # 等待中的情况下
  647.    if @wait_count > 0
  648.      # 减少等待计数
  649.      @wait_count -= 1
  650.      return
  651.    end
  652.    # 强制移动路线的场合
  653.    if @move_route_forcing
  654.      # 自定义移动
  655.      move_type_custom
  656.      return
  657.    end
  658.    # 事件执行待机中并且为锁定状态的情况下
  659.    if @starting or lock?
  660.      # 不做规则移动
  661.      return
  662.    end
  663.    # 如果停止计数超过了一定的值(由移动频度算出)
  664.    if @stop_count > (40 - @move_frequency * 2) * (6 - @move_frequency)
  665.      # 移动类型分支
  666.      case @move_type
  667.      when 1  # 随机
  668.        move_type_random
  669.      when 2  # 接近
  670.        move_type_toward_player
  671.      when 3  # 自定义
  672.        move_type_custom
  673.      end
  674.    end
  675. end
  676. end

  677. class Window_Base < Window
  678. def draw_actor_graphic(actor, x, y)
  679.    bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  680.    cw = bitmap.width / $c3_每一步的帧数
  681.    ch = bitmap.height / $c3_总共可用的方向数
  682.    src_rect = Rect.new(0, 0, cw, ch)
  683.    self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  684. end
  685. end

  686. class Game_Character
  687. #--------------------------------------------------------------------------
  688. # ● 面向主角的方向
  689. #--------------------------------------------------------------------------
  690. def turn_toward_player
  691.    # 求得与主角的坐标差
  692.    sx = @x - $game_player.x
  693.    sy = @y - $game_player.y
  694.    # 坐标相等的场合下
  695.    if sx == 0 and sy == 0
  696.      return
  697.    end
  698.    # 横侧距离长的情况下
  699.    if sx.abs > sy.abs
  700.      # 将左右方向变更为朝向主角的方向
  701.      sx > 0 ? turn_left : turn_right
  702.    # 竖侧距离长的情况下
  703.    else
  704.      # 将上下方向变更为朝向主角的方向
  705.      sy > 0 ? turn_up : turn_down
  706.    end
  707.    if sx == -1 and sy == -1
  708.      unless @direction_fix
  709.        @direction = 3
  710.      end
  711.      @stop_count = 0
  712.    elsif sx == -1 and sy == 1
  713.      unless @direction_fix
  714.        @direction = 9
  715.      end
  716.      @stop_count = 0
  717.    elsif sx == 1 and sy == -1
  718.      unless @direction_fix
  719.        @direction = 1
  720.      end
  721.      @stop_count = 0
  722.    elsif sx == 1 and sy == 1
  723.      unless @direction_fix
  724.        @direction = 7
  725.      end
  726.      @stop_count = 0
  727.    end
  728. end
  729. end
  730. #==============================================================================
  731. #=============================================================================
复制代码
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2014-1-23
帖子
22
10
 楼主| 发表于 2014-1-23 12:39:39 | 只看该作者
谁知道怎么套改啊?
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 12:24

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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