查看: 1520|回复: 2

[已经解决] 用事件设定角色移动路线时如何将画面固定?

  [复制链接]
梦石
0
星屑
50
在线时间
3 小时
注册时间
2005-12-4
回帖
55
发表于 2009-7-11 17:09:19 | 显示全部楼层 |阅读模式

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

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

×
由于地图较大,主角移动时地图画面会自动卷动,使得角色保持在窗口正中。
使用事件设定角色移动路线时,怎样才能将画面固定住呢?

B

梦石
0
星屑
50
在线时间
26 小时
注册时间
2007-8-26
回帖
3622
发表于 2009-7-11 17:35:29 | 显示全部楼层
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
回复

使用道具 举报

梦石
0
星屑
50
在线时间
3 小时
注册时间
2005-12-4
回帖
55
 楼主| 发表于 2009-7-11 18:11:42 | 显示全部楼层
谢谢,解决了~
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部