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

Project1

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

八方向寻路与决定键控制冲突

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
274 小时
注册时间
2008-2-18
帖子
219
跳转到指定楼层
1
发表于 2008-3-19 03:03:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  1. #==============================================================================
  2. # ■ Find_Path
  3. #------------------------------------------------------------------------------
  4. #  寻路算法--完整鼠标系统(八方向)专用版
  5. #   By whbm
  6. #==============================================================================
  7. class Find_Path
  8. #--------------------------------------------------------------------------
  9. def initialize  #初始化
  10. @open_list = []
  11. @close_lise = []
  12. @path = []
  13. end  #结束初始化
  14. #--------------------------------------------------------------------------
  15. def fp_passable?(x, y, d, tr_x = -2, tr_y = -2)  #开始判定通行
  16. return false if (tr_x == @unable_xa or
  17.                  tr_x == @unable_xb or
  18.                  tr_y == @unable_ya or
  19.                  tr_y == @unable_yb)
  20. if [2, 4, 6, 8].include?(d)
  21.    if $game_player.passable?(x, y, d)
  22.      return true
  23.    else
  24.      return false
  25.    end
  26. else
  27.    case d
  28.    when 1
  29.      if ($game_player.passable?(x, y, 4) and
  30.        $game_player.passable?(x - 1, y, 2)) or
  31.         ($game_player.passable?(x, y, 2) and
  32.        $game_player.passable?(x, y + 1, 4))
  33.        return true
  34.      else
  35.        return false
  36.      end
  37.    when 3
  38.      if ($game_player.passable?(x, y, 6) and
  39.        $game_player.passable?(x + 1, y, 2)) or
  40.         ($game_player.passable?(x, y, 2) and
  41.        $game_player.passable?(x, y + 1, 6))
  42.        return true
  43.      else
  44.        return false
  45.      end
  46.    when 7
  47.      if ($game_player.passable?(x, y, 4) and
  48.        $game_player.passable?(x - 1, y, 8)) or
  49.         ($game_player.passable?(x, y, 8) and
  50.        $game_player.passable?(x, y - 1, 4))
  51.        return true
  52.      else
  53.        return false
  54.      end
  55.    when 9
  56.      if ($game_player.passable?(x, y, 6) and
  57.        $game_player.passable?(x + 1, y, 8)) or
  58.         ($game_player.passable?(x, y, 8) and
  59.        $game_player.passable?(x, y - 1, 6))
  60.        return true
  61.      else
  62.        return false
  63.      end
  64.    end
  65. end
  66. end  #结束判定通行
  67. #--------------------------------------------------------------------------
  68. def get_g(now_point)  #开始计算G值
  69. d = now_point[2]
  70. return 0 if d == 5
  71. father_point = get_father_point(now_point)
  72. g = father_point[3] + ((d == 1 or d == 3 or d == 7 or d == 9) ? 14 : 10)
  73. return g
  74. end  #结束计算G值
  75. #--------------------------------------------------------------------------
  76. def get_h(now_point)  #开始计算H值
  77. now_x = now_point[0]
  78. now_y = now_point[1]
  79. #print @trg_x,now_x,@trg_y,now_y
  80. h = (@trg_x - now_x).abs + (@trg_y - now_y).abs
  81. return h * 10
  82. end  #结束计算H值
  83. #--------------------------------------------------------------------------
  84. def get_f(now_point)  #开始计算F值
  85. f = now_point[3] + now_point[4]
  86. return f
  87. end  #结束计算F值
  88. #--------------------------------------------------------------------------
  89. def get_point(x, y) #取已知坐标点
  90. if @open_list.size != 0
  91.    @open_list.each do |point|
  92.      if point[0] == x and point[1] == y
  93.        return point
  94.        break
  95.      end
  96.    end
  97. end
  98. if @close_list.size != 0
  99.    @close_list.each do |point|
  100.      if point[0] == x and point[1] == y
  101.        return point
  102.        break
  103.      end
  104.    end
  105. end
  106. end  #结束取已知坐标点
  107. #--------------------------------------------------------------------------
  108. def get_father_point(now_point)  #取已知点的父节点
  109. d = now_point[2]
  110. return now_point if d == 5
  111. x = now_point[0] + ((d == 9 or d == 6 or d == 3) ? 1 : ((d == 7 or d == 4 or d == 1) ? -1 : 0))
  112. y = now_point[1] + ((d == 1 or d == 2 or d == 3) ? 1 : ((d == 7 or d == 8 or d == 9) ? -1 : 0))
  113. return get_point(x, y)
  114. end  #结束取已知点的父节点
  115. #--------------------------------------------------------------------------
  116. def new_point(x, y, d)  #开始建立新节点
  117. #print x,y,d
  118. point = [x, y, d]
  119. point.push get_g(point)
  120. point.push get_h(point)
  121. point.push get_f(point)
  122. return point
  123. end  #结束建立新节点
  124. #--------------------------------------------------------------------------
  125. def get_direction(self_x, self_y, trg_x, trg_y)
  126.   if trg_x > self_x
  127.     if trg_y - self_y > - 0.4 * ( trg_x - self_x ) and
  128.       trg_y - self_y < 0.4 * ( trg_x - self_x )
  129.       return 6
  130.     end
  131.     if trg_y - self_y > 0.4 * ( trg_x - self_x ) and
  132.       trg_y - self_y < 2.4 * ( trg_x - self_x )
  133.       return 3
  134.     end
  135.     if trg_y - self_y < - 0.4 * ( trg_x - self_x ) and
  136.       trg_y - self_y > - 2.4 * ( trg_x - self_x )
  137.       return 9
  138.     end
  139.     if trg_y - self_y > 2.4 * ( trg_x - self_x )
  140.       return 2
  141.     end
  142.     if trg_y - self_y < - 2.4 * ( trg_x - self_x )
  143.       return 8
  144.     end
  145.   end
  146.   if trg_x < self_x
  147.     if trg_y - self_y > - 0.4 * ( self_x - trg_x ) and
  148.       trg_y - self_y < 0.4 * ( self_x - trg_x )
  149.       return 4
  150.     end
  151.     if trg_y - self_y > 0.4 * ( self_x - trg_x ) and
  152.       trg_y - self_y < 2.4 * ( self_x - trg_x )
  153.       return 1
  154.     end
  155.     if trg_y - self_y < - 0.4 * ( self_x - trg_x ) and
  156.       trg_y - self_y > - 2.4 * ( self_x - trg_x )
  157.       return 7
  158.     end
  159.     if trg_y - self_y > 2.4 * ( self_x - trg_x )
  160.       return 2
  161.     end
  162.     if trg_y - self_y < - 2.4 * ( self_x - trg_x )
  163.       return 8
  164.     end
  165.   end
  166. end
  167. #--------------------------------------------------------------------------
  168. def get_d_x_y(x, y, d)
  169.   d_x = x + ((d == 9 or d == 6 or d == 3) ? 1 : ((d == 7 or d == 4 or d == 1) ? -1 : 0))
  170.   d_y = y + ((d == 1 or d == 2 or d == 3) ? 1 : ((d == 7 or d == 8 or d == 9) ? -1 : 0))
  171.   return d_x, d_y
  172. end
  173. #--------------------------------------------------------------------------
  174. def find_short_path_other(self_x, self_y, trg_x, trg_y,
  175.                           real_self_x, real_self_y, real_trg_x, real_trg_y)
  176.   @self_x = self_x
  177.   @self_y = self_y
  178.   @now_x = self_x
  179.   @now_y = self_y
  180.   @trg_x = trg_x
  181.   @trg_y = trg_y
  182.   @path = []
  183.   direction = get_direction(real_self_x, real_self_y, real_trg_x, real_trg_y)
  184.   @now_trg_x, @now_trg_y = get_d_x_y(@self_x, @self_y, direction)
  185.   while fp_passable?(@now_x, @now_y, direction)
  186.     @path.push direction
  187.     @now_x = @now_trg_x
  188.     @now_y = @now_trg_y
  189.     @now_trg_x, @now_trg_y = get_d_x_y(@now_x, @now_y, direction)
  190.   end
  191.   return @path
  192. end
  193. #--------------------------------------------------------------------------
  194. def find_short_path(self_x, self_y, trg_x, trg_y,
  195.                     real_self_x, real_self_y, real_trg_x, real_trg_y)  #开始搜索路径
  196.   
  197. return find_short_path_other(self_x, self_y, trg_x, trg_y,
  198.                               real_self_x, real_self_y, real_trg_x, real_trg_y) if not
  199.                   (fp_passable?(trg_x, trg_y + 1, 8) or
  200.                    fp_passable?(trg_x + 1, trg_y, 4) or
  201.                    fp_passable?(trg_x - 1, trg_y, 6) or
  202.                    fp_passable?(trg_x, trg_y - 1, 2)) and @goal_type != 1
  203.                   
  204.                   
  205.   #根据屏幕限定搜索面积..加速
  206. @unable_xa = $game_map.display_x / 128 - 1
  207. @unable_ya = $game_map.display_y / 128 - 1
  208. @unable_xb = $game_map.display_x / 128 + 20
  209. @unable_yb = $game_map.display_y / 128 + 20


  210. @self_x = self_x
  211. @self_y = self_y
  212. @now_x = self_x
  213. @now_y = self_y
  214. @trg_x = trg_x
  215. @trg_y = trg_y
  216. @open_list = []
  217. @close_list = []
  218. #准备搜索
  219. #print @self_x,@self_y
  220. @now_point = new_point(@self_x, @self_y, 5) #令起始点为当前点
  221. @open_list.push @now_point #将当前点加入关闭列表
  222. #开始搜索
  223. begin
  224. loop do
  225.    check_trg = check_around_point(@now_point)
  226.    if check_trg == true
  227.      @path = get_path
  228.      break
  229.    end
  230.    @now_point = get_lowest_f_point
  231.    if @now_point == [] or @now_point == nil
  232.      @path = []
  233.      break
  234.    end
  235. end
  236. rescue Hangup
  237.   retry
  238. end
  239. return @path
  240. end  #结束搜索路径
  241. #--------------------------------------------------------------------------
  242. def find_player_short_path(trg_x, trg_y,
  243.                            real_trg_x, real_trg_y)  #寻找角色的最短路径
  244. self_x = $game_player.x
  245. self_y = $game_player.y
  246. real_self_x = $game_player.screen_x
  247. real_self_y = $game_player.screen_y
  248. @goal_type, event = $game_map.check_event_custom_exist(real_trg_x, real_trg_y)
  249. if @goal_type == 1
  250.    trg_x = event.x
  251.    trg_y = event.y
  252. end
  253. return find_short_path(self_x, self_y, trg_x, trg_y,
  254.                         real_self_x, real_self_y, real_trg_x, real_trg_y)
  255. end  #结束角色的寻找路径
  256. #--------------------------------------------------------------------------
  257. def get_path  #取得最终的路径
  258. path = []
  259. now_point = @open_list[@open_list.size - 1]
  260. path.push(10 - now_point[2])
  261. last_point = now_point
  262. loop do
  263.    now_point = get_father_point(now_point)
  264.    break if now_point[2] == 5
  265.    path.push(10 - now_point[2])
  266. end
  267. return path.reverse
  268. end  #结束取得最终的路径
  269. #--------------------------------------------------------------------------
  270. def get_lowest_f_point  #开始取得最低F值的点
  271. if @open_list == []
  272.    return []
  273. end
  274. last_lowest_f_point = @open_list[0]
  275. @open_list.each do |point|
  276.    last_lowest_f_point = point if point[5] < last_lowest_f_point[5]
  277. end
  278. return last_lowest_f_point
  279. end  #结束取得最低F值点
  280. #--------------------------------------------------------------------------
  281. def check_around_point(point)  #开始检查已知点的八方节点
  282. for d in [1, 2, 3, 4, 6, 7, 8, 9]
  283.    x = point[0] + ((d == 9 or d == 6 or d == 3) ? 1 : ((d == 7 or d == 4 or d == 1) ? -1 : 0))
  284.    y = point[1] + ((d == 1 or d == 2 or d == 3) ? 1 : ((d == 7 or d == 8 or d == 9) ? -1 : 0))
  285.    if in_close_list?(x, y) #在关闭列表中
  286.      next
  287.    elsif in_open_list?(x, y) #在开启列表中
  288.      get_new_g_point = new_point(x, y, 10 - d)
  289.      get_last_g_point = get_point(x, y)
  290.      if get_new_g_point[3] >= get_last_g_point[3]
  291.        next
  292.      else
  293.        #如果改变父节点是新G值更小则确定改变
  294.        @open_list[@open_list.index(get_last_g_point)] = get_new_g_point
  295.      end
  296.    else
  297.      if fp_passable?(point[0], point[1], d, x, y)
  298.        # 如果不在开启列表中、且不在关闭列表中、且通行则添加它到新八周节点
  299.        @open_list.push new_point(x, y, 10 - d)
  300.        #如果将目标点添加到了开启列表中就返回true
  301.        return true if x == @trg_x and y == @trg_y
  302.        return true if @goal_type == 1 and [1, 0, -1].include?(x - @trg_x) and [1, 0, -1].include?(y - @trg_y)
  303.      end
  304.    end
  305. end
  306. #此刻没有找到目标点并将当前点加入关闭列表并在开启列表中删除
  307. @close_list.push point
  308. @open_list.delete(point)
  309. #此刻没找到目标点并返回false
  310. return false
  311. end  #结束计算已知点的八方节点
  312. #--------------------------------------------------------------------------
  313. def in_open_list?(x, y)  #开始检查谋点是否在开启列表中
  314. @open_list.each do |point|
  315.    return true if point[0] == x and point[1] == y
  316. end
  317. return false
  318. end  #结束检查谋点是否在开启列表中
  319. #--------------------------------------------------------------------------
  320. def in_close_list?(x, y)  #开始检查谋点是否在关闭列表中
  321. @close_list.each do |point|
  322.    return true if point[0] == x and point[1] == y
  323. end
  324. return false
  325. end  #结束检查谋点是否在关闭列表中
  326. #--------------------------------------------------------------------------
  327. end
复制代码
  1. #=============================
  2. # ■ Game_Player
  3. #------------------------------------------------------------------------------
  4. #  处理主角的类。事件启动的判定、以及地图的滚动等功能。
  5. # 本类的实例请参考 $game_player。
  6. #===========================================================================
  7. $决定键失效 = 20   # 开关25号打开的时候决定键失效
  8. #===========================================================================
  9. class Game_Player < Game_Character
  10. #--------------------------------------------------------------------------
  11. # ● 恒量
  12. #--------------------------------------------------------------------------
  13. CENTER_X = (320 - 16) * 4   # 画面中央的 X 坐标 * 4
  14. CENTER_Y = (240 - 16) * 4   # 画面中央的 Y 坐标 * 4
  15. #--------------------------------------------------------------------------
  16. # ● 可以通行判定
  17. #     x : X 坐标
  18. #     y : Y 坐标
  19. #     d : 方向 (0,2,4,6,8)  ※ 0 = 全方向不能通行的情况判定 (跳跃用)
  20. #--------------------------------------------------------------------------
  21. def passable?(x, y, d)
  22.    # 求得新的坐标
  23.    new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
  24.    new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
  25.    # 坐标在地图外的情况下
  26.    unless $game_map.valid?(new_x, new_y)
  27.      # 不能通行
  28.      return false
  29.    end
  30.    # 调试模式为 ON 并且 按下 CTRL 键的情况下
  31.    if $DEBUG and Input.press?(Input::CTRL)
  32.      # 可以通行
  33.      return true
  34.    end
  35.    super
  36. end
  37. #--------------------------------------------------------------------------
  38. # ● 像通到画面中央一样的设置地图的显示位置
  39. #--------------------------------------------------------------------------
  40. def center(x, y)
  41.    max_x = ($game_map.width - 20) * 128
  42.    max_y = ($game_map.height - 15) * 128
  43.    $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
  44.    $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max
  45. end
  46. #--------------------------------------------------------------------------
  47. # ● 向指定的位置移动
  48. #     x : X 座標
  49. #     y : Y 座標
  50. #--------------------------------------------------------------------------
  51. def moveto(x, y)
  52.    super
  53.    # 自连接
  54.    center(x, y)
  55.    # 生成遇敌计数
  56.    make_encounter_count
  57. end
  58. #--------------------------------------------------------------------------
  59. # ● 增加步数
  60. #--------------------------------------------------------------------------
  61. def increase_steps
  62.    super
  63.    # 不是强制移动路线的场合
  64.    unless @move_route_forcing
  65.      # 增加步数
  66.      $game_party.increase_steps
  67.      # 步数是偶数的情况下
  68.      if $game_party.steps % 2 == 0
  69.        # 检查连续伤害
  70.        $game_party.check_map_slip_damage
  71.      end
  72.    end
  73. end
  74. #--------------------------------------------------------------------------
  75. # ● 获取遇敌计数
  76. #--------------------------------------------------------------------------
  77. def encounter_count
  78.    return @encounter_count
  79. end
  80. #--------------------------------------------------------------------------
  81. # ● 生成遇敌计数
  82. #--------------------------------------------------------------------------
  83. def make_encounter_count
  84.    # 两种颜色震动的图像
  85.    if $game_map.map_id != 0
  86.      n = $game_map.encounter_step
  87.      @encounter_count = rand(n) + rand(n) + 1
  88.    end
  89. end
  90. #--------------------------------------------------------------------------
  91. # ● 刷新
  92. #--------------------------------------------------------------------------
  93. def refresh
  94.    # 同伴人数为 0 的情况下
  95.    if $game_party.actors.size == 0
  96.      # 清除角色的文件名及对像
  97.      @character_name = ""
  98.      @character_hue = 0
  99.      # 分支结束
  100.      return
  101.    end
  102.    # 获取带头的角色
  103.    actor = $game_party.actors[0]
  104.    # 设置角色的文件名及对像
  105.    @character_name = actor.character_name
  106.    @character_hue = actor.character_hue
  107.    # 初始化不透明度和合成方式子
  108.    @opacity = 255
  109.    @blend_type = 0
  110. end
  111. #--------------------------------------------------------------------------
  112. # ● 同位置的事件启动判定
  113. #--------------------------------------------------------------------------
  114. def check_event_trigger_here(triggers)
  115.    result = false
  116.    # 事件执行中的情况下
  117.    if $game_system.map_interpreter.running?
  118.      return result
  119.    end
  120.    # 全部事件的循环
  121.    for event in $game_map.events.values
  122.      # 事件坐标与目标一致的情况下
  123.      if event.x == @x and event.y == @y and triggers.include?(event.trigger)
  124.        # 跳跃中以外的情况下、启动判定是同位置的事件
  125.        if not event.jumping? and event.over_trigger?
  126.          event.start
  127.          result = true
  128.        end
  129.      end
  130.    end
  131.    return result
  132. end
  133. #--------------------------------------------------------------------------
  134. # ● 正面事件的启动判定
  135. #--------------------------------------------------------------------------
  136. def check_event_trigger_there(triggers)
  137.    result = false
  138.    # 事件执行中的情况下
  139.    if $game_system.map_interpreter.running?
  140.      return result
  141.    end
  142.    # 计算正面坐标
  143.    new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  144.    new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  145.    # 全部事件的循环
  146.    for event in $game_map.events.values
  147.      # 事件坐标与目标一致的情况下
  148.      if event.x == new_x and event.y == new_y and
  149.         triggers.include?(event.trigger)
  150.        # 跳跃中以外的情况下、启动判定是正面的事件
  151.        if not event.jumping? and not event.over_trigger?
  152.          event.start
  153.          result = true
  154.        end
  155.      end
  156.    end
  157.    # 找不到符合条件的事件的情况下
  158.    if result == false
  159.      # 正面的元件是计数器的情况下
  160.      if $game_map.counter?(new_x, new_y)
  161.        # 计算 1 元件里侧的坐标
  162.        new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)
  163.        new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)
  164.        # 全事件的循环
  165.        for event in $game_map.events.values
  166.          # 事件坐标与目标一致的情况下
  167.          if event.x == new_x and event.y == new_y and
  168.             triggers.include?(event.trigger)
  169.            # 跳跃中以外的情况下、启动判定是正面的事件
  170.            if not event.jumping? and not event.over_trigger?
  171.              event.start
  172.              result = true
  173.            end
  174.          end
  175.        end
  176.      end
  177.    end
  178.    return result
  179. end
  180. #--------------------------------------------------------------------------
  181. # ● 接触事件启动判定
  182. #--------------------------------------------------------------------------
  183. def check_event_trigger_touch(x, y)
  184.    result = false
  185.    # 事件执行中的情况下
  186.    if $game_system.map_interpreter.running?
  187.      return result
  188.    end
  189.    # 全事件的循环
  190.    for event in $game_map.events.values
  191.      # 事件坐标与目标一致的情况下
  192.      if event.x == x and event.y == y and [1,2].include?(event.trigger)
  193.        # 跳跃中以外的情况下、启动判定是正面的事件
  194.        if not event.jumping? and not event.over_trigger?
  195.          event.start
  196.          result = true
  197.        end
  198.      end
  199.    end
  200.    return result
  201. end
  202. #--------------------------------------------------------------------------
  203. # ● 画面更新
  204. #--------------------------------------------------------------------------
  205. def update
  206.    # 本地变量记录移动信息
  207.    last_moving = moving?
  208.    # 移动中、事件执行中、强制移动路线中、
  209.    # 信息窗口一个也不显示的时候
  210.    unless moving? or $game_system.map_interpreter.running? or
  211.           @move_route_forcing or $game_temp.message_window_showing
  212.      # 如果方向键被按下、主角就朝那个方向移动
  213.      case Input.dir4
  214.      when 2
  215.        move_down
  216.      when 4
  217.        move_left
  218.      when 6
  219.        move_right
  220.      when 8
  221.        move_up
  222.      end
  223.    end
  224.    # 本地变量记忆坐标
  225.    last_real_x = @real_x
  226.    last_real_y = @real_y
  227.    super
  228.    # 角色向下移动、画面上的位置在中央下方的情况下
  229.    if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  230.      # 画面向下卷动
  231.      $game_map.scroll_down(@real_y - last_real_y)
  232.    end
  233.    # 角色向左移动、画面上的位置在中央左方的情况下
  234.    if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  235.      # 画面向左卷动
  236.      $game_map.scroll_left(last_real_x - @real_x)
  237.    end
  238.    # 角色向右移动、画面上的位置在中央右方的情况下
  239.    if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  240.      # 画面向右卷动
  241.      $game_map.scroll_right(@real_x - last_real_x)
  242.    end
  243.    # 角色向上移动、画面上的位置在中央上方的情况下
  244.    if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  245.      # 画面向上卷动
  246.      $game_map.scroll_up(last_real_y - @real_y)
  247.    end
  248.    # 不在移动中的情况下
  249.    unless moving?
  250.      # 上次主角移动中的情况
  251.      if last_moving
  252.        # 与同位置的事件接触就判定为事件启动
  253.        result = check_event_trigger_here([1,2])
  254.        # 没有可以启动的事件的情况下
  255.        if result == false
  256.          # 调试模式为 ON 并且按下 CTRL 键的情况下除外
  257.          unless $DEBUG and Input.press?(Input::CTRL)
  258.            # 遇敌计数下降
  259.            if @encounter_count > 0
  260.              @encounter_count -= 1
  261.            end
  262.          end
  263.        end
  264.      end
  265.      # 按下 C 键的情况下
  266.    if $game_switches[$决定键失效] == true      
  267.      else
  268.      if Input.trigger?(Input::C)
  269.        # 判定为同位置以及正面的事件启动
  270.        check_event_trigger_here([0])
  271.        check_event_trigger_there([0,1,2])
  272.      end
  273.    end
  274. end
  275. end
  276. end
复制代码

两个一起用 ~八方向 失效
谁帮我整和下?
版务信息:本贴由楼主自主结贴~

Lv5.捕梦者

御灵的宠物

梦石
12
星屑
8481
在线时间
94 小时
注册时间
2006-12-11
帖子
3156

第2届TG大赛亚军

2
发表于 2008-3-19 03:05:01 | 只看该作者
第二个是什么脚本?
另,希望LZ尽量搜索两者的共同之处自己整合,不然永远也没进步的
我的Lofter:http://nightoye.lofter.com/

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
274 小时
注册时间
2008-2-18
帖子
219
3
 楼主| 发表于 2008-3-19 03:16:30 | 只看该作者
以下引用水迭澜于2008-3-18 19:05:01的发言:

第二个是什么脚本?
另,希望LZ尽量搜索两者的共同之处自己整合,不然永远也没进步的

怎么说~ 每次你的话
好像都没什么帮助 - -
回复 支持 反对

使用道具 举报

Lv5.捕梦者

御灵的宠物

梦石
12
星屑
8481
在线时间
94 小时
注册时间
2006-12-11
帖子
3156

第2届TG大赛亚军

4
发表于 2008-3-19 03:24:40 | 只看该作者
既然觉得我没什么帮助您就等有帮助的人来吧。
我可不大喜欢帮助别人干整合脚本这种没建设性又无聊的事。反正又没工资我拿。
我的Lofter:http://nightoye.lofter.com/

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
274 小时
注册时间
2008-2-18
帖子
219
5
 楼主| 发表于 2008-3-19 03:28:44 | 只看该作者
{/cy}别生气拉
还是有"一定"的作用地!
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

悔恨的天使

梦石
0
星屑
50
在线时间
0 小时
注册时间
2008-2-26
帖子
726
6
发表于 2008-3-19 03:29:16 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv5.捕梦者

御灵的宠物

梦石
12
星屑
8481
在线时间
94 小时
注册时间
2006-12-11
帖子
3156

第2届TG大赛亚军

7
发表于 2008-3-19 03:44:26 | 只看该作者
叹,刚才有些动气了,抱歉LZ
参考一下楼上吧~
我的Lofter:http://nightoye.lofter.com/

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
274 小时
注册时间
2008-2-18
帖子
219
8
 楼主| 发表于 2008-3-19 04:49:31 | 只看该作者
以下引用Iselia雪于2008-3-18 19:29:16的发言:

同水娘娘,用力握爪(捏碎哈哈)。
我略位好心点,那个决定键失效无非是把事件启动套上了分歧。

if $game_switches[$决定键失效] == true      
    else
    if Input.trigger?(Input::C)
      # 判定为同位置以及正面的事件启动
      check_event_trigger_here([0])
      check_event_trigger_there([0,1,2])
    end
  end

八方向的Game_Player里面照猫画虎给同样的地方套上判断分歧就可以啦……

饿 - -还是不懂...
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
25
在线时间
0 小时
注册时间
2008-3-19
帖子
2
9
发表于 2008-3-19 04:53:31 | 只看该作者
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
274 小时
注册时间
2008-2-18
帖子
219
10
 楼主| 发表于 2008-3-19 19:58:26 | 只看该作者
如果还要 使一段时间内不能移动呢?
比如 开关20=ON 就不能移动
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-23 20:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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