Project1

标题: 用事件设定角色移动路线时如何将画面固定? [打印本页]

作者: xyxw    时间: 2009-7-11 17:09
标题: 用事件设定角色移动路线时如何将画面固定?
由于地图较大,主角移动时地图画面会自动卷动,使得角色保持在窗口正中。
使用事件设定角色移动路线时,怎样才能将画面固定住呢?
作者: ONEWateR    时间: 2009-7-11 17:35
class Game_Player < Game_Character
  def update
    last_moving = moving?
    unless moving? or $game_system.map_interpreter.running? or
           @move_route_forcing or $game_temp.message_window_showing
      case Input.dir4
      when 2
        move_down
      when 4
        move_left
      when 6
        move_right
      when 8
        move_up
      end
    end
    last_real_x = @real_x
    last_real_y = @real_y
    super
   
    if !$game_switches[1] #当开关一打开的时候,画面固定
   
    if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
      $game_map.scroll_down(@real_y - last_real_y)
    end
    if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
      $game_map.scroll_left(last_real_x - @real_x)
    end
    if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
      $game_map.scroll_right(@real_x - last_real_x)
    end
    if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
      $game_map.scroll_up(last_real_y - @real_y)
    end
   
  end
  
    unless moving?
      if last_moving
        result = check_event_trigger_here([1,2])
        if result == false
          unless $DEBUG and Input.press?(Input::CTRL)
            if @encounter_count > 0
              @encounter_count -= 1
            end
          end
        end
      end
      if Input.trigger?(Input::C)
        check_event_trigger_here([0])
        check_event_trigger_there([0,1,2])
      end
    end
  end
end
作者: xyxw    时间: 2009-7-11 18:11
谢谢,解决了~




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1