| 赞 | 1  | 
 
| VIP | 0 | 
 
| 好人卡 | 0 | 
 
| 积分 | 1 | 
 
| 经验 | 5065 | 
 
| 最后登录 | 2025-7-9 | 
 
| 在线时间 | 104 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 80 
 
        - 在线时间
 - 104 小时
 
        - 注册时间
 - 2011-3-19
 
        - 帖子
 - 41
 
 
 
 | 
	
  #-------------------------------------------------------------------------- 
  # ● 下(左下) 
  #     turn_ok : 此地可以更改朝向 
  #-------------------------------------------------------------------------- 
  def move_down(turn_ok = true) 
    unless @direction_fix 
      @direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction) 
    end 
    if (passable?(@x, @y+1) and passable?(@x-1, @y+1)) or 
       (passable?(@x-1, @y) and passable?(@x-1, @y+1)) 
      turn_down 
      @x -= 1 
      @y += 1       
      increase_steps 
      @move_failed = false 
    else                                    # 不可以通过 
      turn_down if turn_ok 
      check_event_trigger_touch(@x, @y+1)   # 判断接触的事件启动 
      @move_failed = true 
    end 
  end 
  #-------------------------------------------------------------------------- 
  # ● 左(左上) 
  #     turn_ok : 此地可以更改朝向 
  #-------------------------------------------------------------------------- 
  def move_left(turn_ok = true) 
    unless @direction_fix 
      @direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction) 
    end 
    if (passable?(@x, @y-1) and passable?(@x-1, @y-1)) or 
       (passable?(@x-1, @y) and passable?(@x-1, @y-1)) 
      turn_left 
      @x -= 1 
      @y -= 1 
      increase_steps 
      @move_failed = false 
    else                                    # 不可以通过 
      turn_left if turn_ok 
      check_event_trigger_touch(@x-1, @y)   # 判断接触的事件启动 
      @move_failed = true 
    end 
  end 
  #-------------------------------------------------------------------------- 
  # ● 右(右下) 
  #     turn_ok : 此地可以更改朝向 
  #-------------------------------------------------------------------------- 
  def move_right(turn_ok = true) 
    unless @direction_fix 
      @direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction) 
    end 
    if (passable?(@x, @y+1) and passable?(@x+1, @y+1)) or 
       (passable?(@x+1, @y) and passable?(@x+1, @y+1)) 
      turn_right 
      @x += 1 
      @y += 1 
      increase_steps 
      @move_failed = false 
    else                                    # 不可以通过 
      turn_right if turn_ok 
      check_event_trigger_touch(@x+1, @y)   # 判断接触的事件启动 
      @move_failed = true 
    end 
  end 
  #-------------------------------------------------------------------------- 
  # ● 上(右上) 
  #     turn_ok : 此地可以更改朝向 
  #-------------------------------------------------------------------------- 
  def move_up(turn_ok = true) 
    unless @direction_fix 
      @direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction) 
    end 
    if (passable?(@x, @y-1) and passable?(@x+1, @y-1)) or 
       (passable?(@x+1, @y) and passable?(@x+1, @y-1)) 
      turn_up 
      @x += 1 
      @y -= 1 
      increase_steps 
      @move_failed = false 
    else                                    # 不可以通过 
      turn_up if turn_ok 
      check_event_trigger_touch(@x, @y-1)   # 判断接触的事件启动 
      @move_failed = true 
    end 
  end 
 
 
 
 
这样npc也是斜着走。但是和触发事件的手感很差。而且地图上有一半格子走不到(国际象棋里的象) 
 
另外弱弱的问一句。脚本里经常说的真伪是什么意思。。。 |   
 
 
 
 |