| 赞 | 12  | 
 
| VIP | 107 | 
 
| 好人卡 | 6 | 
 
| 积分 | 4 | 
 
| 经验 | 31122 | 
 
| 最后登录 | 2024-6-29 | 
 
| 在线时间 | 1606 小时 | 
 
 
 
 
 
Lv2.观梦者 傻♂逼 
	- 梦石
 - 0 
 
        - 星屑
 - 374 
 
        - 在线时间
 - 1606 小时
 
        - 注册时间
 - 2007-3-13
 
        - 帖子
 - 6562
 
 
   
 
 | 
	
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员  
 
x
 
烛光 
不过有效果的只有角色 
问题就在于事件的screen_x(y)坐标是不变的(至少通过screen_x(y)获得的不会变) 
- $角色开灯的开光 = 1
 
 - #==============================================================================
 
 - # ■ Game_Player
 
 - #------------------------------------------------------------------------------
 
 - #  处理主角的类。事件启动的判定、以及地图的滚动等功能。
 
 - # 本类的实例请参考 $game_player。
 
 - #==============================================================================
 
  
- class Game_Player < Game_Character
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 常量
 
 -   #--------------------------------------------------------------------------
 
 -   CENTER_X = (544 / 2 - 16) * 8     # 画面中央 X 座标 * 8
 
 -   CENTER_Y = (416 / 2 - 16) * 8     # 画面中央 Y 座标 * 8
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 定义实例变量
 
 -   #--------------------------------------------------------------------------
 
 -   attr_reader   :vehicle_type       # 目前乘坐交通工具类型
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 初始化对像
 
 -   #--------------------------------------------------------------------------
 
 -   def initialize
 
 -     super
 
 -     @vehicle_type = -1
 
 -     @vehicle_getting_on = false     # 乘坐交通工具标志
 
 -     @vehicle_getting_off = false    # 离开交通工具标志
 
 -     @transferring = false           # 场所移动标志
 
 -     @new_map_id = 0                 # 目标地图 ID
 
 -     @new_x = 0                      # 目标 X 座标
 
 -     @new_y = 0                      # 目标 Y 座标
 
 -     @new_direction = 0              # 移动後方向
 
 -     @walking_bgm = nil              # 记忆用行走时 BGM
 
 -  #   @light = Sprite.new             #烛光
 
 -  #   @light.bitmap = Cache.picture("light.png") #烛光
 
 -  #   @light.opacity = 0              #烛光
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断是否停止
 
 -   #--------------------------------------------------------------------------
 
 -   def stopping?
 
 -     return false if @vehicle_getting_on
 
 -     return false if @vehicle_getting_off
 
 -     return super
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 场所移动准备
 
 -   #     map_id    : 地图 ID
 
 -   #     x         : X 座标
 
 -   #     y         : Y 座标
 
 -   #     direction : 移动後面向
 
 -   #--------------------------------------------------------------------------
 
 -   def reserve_transfer(map_id, x, y, direction)
 
 -     @transferring = true
 
 -     @new_map_id = map_id
 
 -     @new_x = x
 
 -     @new_y = y
 
 -     @new_direction = direction
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断是否准备场所移动
 
 -   #--------------------------------------------------------------------------
 
 -   def transfer?
 
 -     return @transferring
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 执行场所移动
 
 -   #--------------------------------------------------------------------------
 
 -   def perform_transfer
 
 -     return unless @transferring
 
 -     @transferring = false
 
 -     set_direction(@new_direction)
 
 -     if $game_map.map_id != @new_map_id
 
 -       $game_map.setup(@new_map_id)     # 移动到另一地图
 
 -     end
 
 -     moveto(@new_x, @new_y)
 
 -     @walking_bgm = $game_map.map.bgm 
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断地图是否可以通行
 
 -   #     x:X 座标
 
 -   #     y:Y 座标
 
 -   #--------------------------------------------------------------------------
 
 -   def map_passable?(x, y)
 
 -     case @vehicle_type
 
 -     when 0  # 小型船
 
 -       return $game_map.boat_passable?(x, y)
 
 -     when 1  # 大型船
 
 -       return $game_map.ship_passable?(x, y)
 
 -     when 2  # 飞船
 
 -       return true
 
 -     else    # 行走
 
 -       return $game_map.passable?(x, y)
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断行走通行度
 
 -   #     x:X 座标
 
 -   #     y:Y 座标
 
 -   #--------------------------------------------------------------------------
 
 -   def can_walk?(x, y)
 
 -     last_vehicle_type = @vehicle_type   # 移除交通工具类型
 
 -     @vehicle_type = -1                  # 暂时设置为行走
 
 -     result = passable?(x, y)            # 判断是否可以通行
 
 -     @vehicle_type = last_vehicle_type   # 回复交通工具类型
 
 -     return result
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断飞船降落通行度
 
 -   #     x:X 座标
 
 -   #     y:Y 座标
 
 -   #--------------------------------------------------------------------------
 
 -   def airship_land_ok?(x, y)
 
 -     unless $game_map.airship_land_ok?(x, y)
 
 -       return false    # 指定地图图块无法降落
 
 -     end
 
 -     unless $game_map.events_xy(x, y).empty?
 
 -       return false    # 不可降落于事件之上
 
 -     end
 
 -     return true       # 可以降落
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断是否在交通工具上
 
 -   #--------------------------------------------------------------------------
 
 -   def in_vehicle?
 
 -     return @vehicle_type >= 0
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断是否在飞船之上
 
 -   #--------------------------------------------------------------------------
 
 -   def in_airship?
 
 -     return @vehicle_type == 2
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断是否奔跑中
 
 -   #--------------------------------------------------------------------------
 
 -   def dash?
 
 -     return false if @move_route_forcing
 
 -     return false if $game_map.disable_dash?
 
 -     return false if in_vehicle?
 
 -     return Input.press?(Input::A)
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断是否是游戏测试通行状态
 
 -   #--------------------------------------------------------------------------
 
 -   def debug_through?
 
 -     return false unless $TEST
 
 -     return Input.press?(Input::CTRL)
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 设置地图画面座标为画面中央
 
 -   #     x:X 座标
 
 -   #     y:Y 座标
 
 -   #--------------------------------------------------------------------------
 
 -   def center(x, y)
 
 -     display_x = x * 256 - CENTER_X                    # 计算座标
 
 -     unless $game_map.loop_horizontal?                 # 非横向回圈的场合
 
 -       max_x = ($game_map.width - 17) * 256            # 计算最大值
 
 -       display_x = [0, [display_x, max_x].min].max     # 校正座标
 
 -     end
 
 -     display_y = y * 256 - CENTER_Y                    # 计算座标
 
 -     unless $game_map.loop_vertical?                   # 非横向回圈的场合
 
 -       max_y = ($game_map.height - 13) * 256           # 计算最大值
 
 -       display_y = [0, [display_y, max_y].min].max     # 校正座标
 
 -     end
 
 -     $game_map.set_display_pos(display_x, display_y)   # 改变地图位置
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 移动至指定位置
 
 -   #     x:X 座标
 
 -   #     y:Y 座标
 
 -   #--------------------------------------------------------------------------
 
 -   def moveto(x, y)
 
 -     super
 
 -     center(x, y)                                      # 居中对齐
 
 -     make_encounter_count                              # 初始化遇敌
 
 -     if in_vehicle?                                    # 在交通工具中的场合
 
 -       vehicle = $game_map.vehicles[@vehicle_type]     # 获取交通工具
 
 -       vehicle.refresh                                 # 刷新交通工具
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 增加步数
 
 -   #--------------------------------------------------------------------------
 
 -   def increase_steps
 
 -     super
 
 -     return if @move_route_forcing
 
 -     return if in_vehicle?
 
 -     $game_party.increase_steps
 
 -     $game_party.on_player_walk
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 设置遇敌计数
 
 -   #--------------------------------------------------------------------------
 
 -   def encounter_count
 
 -     return @encounter_count
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 初始化遇敌计数
 
 -   #--------------------------------------------------------------------------
 
 -   def make_encounter_count
 
 -     if $game_map.map_id != 0
 
 -       n = $game_map.encounter_step
 
 -       @encounter_count = rand(n) + rand(n) + 1  # 好比掷两个骰子
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断是否在地图区域中
 
 -   #     area : 区域数据(RPG::Area)
 
 -   #--------------------------------------------------------------------------
 
 -   def in_area?(area)
 
 -     return false if area == nil
 
 -     return false if $game_map.map_id != area.map_id
 
 -     return false if @x < area.rect.x
 
 -     return false if @y < area.rect.y
 
 -     return false if @x >= area.rect.x + area.rect.width
 
 -     return false if @y >= area.rect.y + area.rect.height
 
 -     return true
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 生成遇敌队伍
 
 -   #--------------------------------------------------------------------------
 
 -   def make_encounter_troop_id
 
 -     encounter_list = $game_map.encounter_list.clone
 
 -     for area in $data_areas.values
 
 -       encounter_list += area.encounter_list if in_area?(area)
 
 -     end
 
 -     if encounter_list.empty?
 
 -       make_encounter_count
 
 -       return 0
 
 -     end
 
 -     return encounter_list[rand(encounter_list.size)]
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 刷新
 
 -   #--------------------------------------------------------------------------
 
 -   def refresh
 
 -     if $game_party.members.size == 0
 
 -       @character_name = ""
 
 -       @character_index = 0
 
 -     else
 
 -       actor = $game_party.members[0]   # 获取队伍第一人
 
 -       @character_name = actor.character_name
 
 -       @character_index = actor.character_index
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断同位置事件是否被触发
 
 -   #     triggers : 触发数组
 
 -   #--------------------------------------------------------------------------
 
 -   def check_event_trigger_here(triggers)
 
 -     return false if $game_map.interpreter.running?
 
 -     result = false
 
 -     for event in $game_map.events_xy(@x, @y)
 
 -       if triggers.include?(event.trigger) and event.priority_type != 1
 
 -         event.start
 
 -         result = true if event.starting
 
 -       end
 
 -     end
 
 -     return result
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 确认前方事件是否被触发
 
 -   #     triggers : 触发数组
 
 -   #--------------------------------------------------------------------------
 
 -   def check_event_trigger_there(triggers)
 
 -     return false if $game_map.interpreter.running?
 
 -     result = false
 
 -     front_x = $game_map.x_with_direction(@x, @direction)
 
 -     front_y = $game_map.y_with_direction(@y, @direction)
 
 -     for event in $game_map.events_xy(front_x, front_y)
 
 -       if triggers.include?(event.trigger) and event.priority_type == 1
 
 -         event.start
 
 -         result = true
 
 -       end
 
 -     end
 
 -     if result == false and $game_map.counter?(front_x, front_y)
 
 -       front_x = $game_map.x_with_direction(front_x, @direction)
 
 -       front_y = $game_map.y_with_direction(front_y, @direction)
 
 -       for event in $game_map.events_xy(front_x, front_y)
 
 -         if triggers.include?(event.trigger) and event.priority_type == 1
 
 -           event.start
 
 -           result = true
 
 -         end
 
 -       end
 
 -     end
 
 -     return result
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断接触事件是否被触发
 
 -   #     x:X 座标
 
 -   #     y:Y 座标
 
 -   #--------------------------------------------------------------------------
 
 -     def check_event_trigger_touch(x, y) 
 
 -     x -=  $game_map.width if $game_map.loop_horizontal? and x == $game_map.width
 
 -     y -=  $game_map.height if $game_map.loop_vertical? and y == $game_map.height
 
 -     return false if $game_map.interpreter.running?
 
 -     result = false
 
 -     for event in $game_map.events_xy(x, y)
 
 -       if [1,2].include?(event.trigger) and event.priority_type == 1
 
 -         event.start
 
 -         result = true
 
 -       end
 
 -     end
 
 -     return result
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 方向键移动处理
 
 -   #--------------------------------------------------------------------------
 
 -   def move_by_input
 
 -     return unless movable?
 
 -     return if $game_map.interpreter.running?
 
 -     case Input.dir4
 
 -     when 2;  move_down
 
 -     when 4;  move_left
 
 -     when 6;  move_right
 
 -     when 8;  move_up
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 可以行动判定
 
 -   #--------------------------------------------------------------------------
 
 -   def movable?
 
 -     return false if moving?                     # 正在移动
 
 -     return false if @move_route_forcing         # 强制移动路线
 
 -     return false if @vehicle_getting_on         # 正在乘上交通工具
 
 -     return false if @vehicle_getting_off        # 正在乘上交通工具
 
 -     return false if $game_message.visible       # 正在显示讯息
 
 -     return false if in_airship? and not $game_map.airship.movable?
 
 -     return true
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 更新画面
 
 -   #--------------------------------------------------------------------------
 
 -   def update
 
 -     last_real_x = @real_x
 
 -     last_real_y = @real_y
 
 -     last_moving = moving?
 
 -     move_by_input
 
 -     super
 
 -     update_scroll(last_real_x, last_real_y)
 
 -     update_vehicle
 
 -     update_nonmoving(last_moving)
 
 -     if $game_switches[$角色开灯的开光]
 
 - #      @light.opacity = 255 if @light.opacity == 0
 
 -       if ((@oldx != screen_x) or (@oldy != screen_y)) or $evmove
 
 -         $evmove = false
 
 -         @oldx = screen_x#@x* 32
 
 -         @oldy = screen_y#@y* 32
 
 -    #     if (@oldx - (2*32) <= 0) or (@oldy - (2*32) <= 0)
 
 -     #      $scene.light(@oldx,@oldy,160,160)
 
 -       #    @light.x = @oldx - (2*32)
 
 -       #    @light.y = 0#@oldy
 
 -     #    else
 
 -           $scene.light(@oldx-(2*32),@oldy-(3*32),160,160)
 
 -       #    @light.x = @oldx-(2*32)
 
 -       #    @light.y = @oldy-(2*32)
 
 -         #p @light.y
 
 -      #   end
 
 -       end
 
 -     else
 
 -       $scene.light if @oldx!=0
 
 -       @oldx = 0 if @oldx!=0
 
 -       @oldy = 0 if @oldy!=0
 
 -       #@light.opacity = 0 if @light.opacity == 255
 
 -       
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 更新滚动
 
 -   #--------------------------------------------------------------------------
 
 -   def update_scroll(last_real_x, last_real_y)
 
 -     ax1 = $game_map.adjust_x(last_real_x)
 
 -     ay1 = $game_map.adjust_y(last_real_y)
 
 -     ax2 = $game_map.adjust_x(@real_x)
 
 -     ay2 = $game_map.adjust_y(@real_y)
 
 -     if ay2 > ay1 and ay2 > CENTER_Y
 
 -       $game_map.scroll_down(ay2 - ay1)
 
 -     end
 
 -     if ax2 < ax1 and ax2 < CENTER_X
 
 -       $game_map.scroll_left(ax1 - ax2)
 
 -     end
 
 -     if ax2 > ax1 and ax2 > CENTER_X
 
 -       $game_map.scroll_right(ax2 - ax1)
 
 -     end
 
 -     if ay2 < ay1 and ay2 < CENTER_Y
 
 -       $game_map.scroll_up(ay1 - ay2)
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 更新交通工具
 
 -   #--------------------------------------------------------------------------
 
 -   def update_vehicle
 
 -     return unless in_vehicle?
 
 -     vehicle = $game_map.vehicles[@vehicle_type]
 
 -     if @vehicle_getting_on                    # 正在乘上?
 
 -       if not moving?
 
 -         @direction = vehicle.direction        # 更改方向
 
 -         @move_speed = vehicle.speed           # 更改移动速度
 
 -         @vehicle_getting_on = false           # 结束乘上操作
 
 -         @transparent = true                   # 透明状态
 
 -       end
 
 -     elsif @vehicle_getting_off                # 正在离开?
 
 -       if not moving? and vehicle.altitude == 0
 
 -         @vehicle_getting_off = false          # 结束乘上操作
 
 -         @vehicle_type = -1                    # 清除交通工具类型
 
 -         @transparent = false                  # 移除透明状态
 
 -       end
 
 -     else                                      # 正在交通工具之上
 
 -       vehicle.sync_with_player                # 与角色同步移动
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 非移动中更新
 
 -   #     last_moving : 之前是否正在移动
 
 -   #--------------------------------------------------------------------------
 
 -   def update_nonmoving(last_moving)
 
 -     return if $game_map.interpreter.running?
 
 -     return if moving?
 
 -     return if check_touch_event if last_moving
 
 -     if not $game_message.visible and Input.trigger?(Input::C)
 
 -       return if get_on_off_vehicle
 
 -       return if check_action_event
 
 -     end
 
 -     update_encounter if last_moving
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 更新遇敌
 
 -   #--------------------------------------------------------------------------
 
 -   def update_encounter
 
 -     return if $TEST and Input.press?(Input::CTRL)   # 测试游戏中
 
 -     return if in_vehicle?                           # 乘坐交通工具中
 
 -     if $game_map.bush?(@x, @y)                      # 在草木繁茂处
 
 -       @encounter_count -= 2                         # 将遇敌计数减2
 
 -     else                                            # 否则
 
 -       @encounter_count -= 1                         # 将遇敌计数减1
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断事件是否由接触触发(重叠)
 
 -   #--------------------------------------------------------------------------
 
 -   def check_touch_event
 
 -     return false if in_airship?
 
 -     return check_event_trigger_here([1,2])
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断事件是否由确认键触发
 
 -   #--------------------------------------------------------------------------
 
 -   def check_action_event
 
 -     return false if in_airship?
 
 -     return true if check_event_trigger_here([0])
 
 -     return check_event_trigger_there([0,1,2])
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 上下交通工具
 
 -   #--------------------------------------------------------------------------
 
 -   def get_on_off_vehicle
 
 -     return false unless movable?
 
 -     if in_vehicle?
 
 -       return get_off_vehicle
 
 -     else
 
 -       return get_on_vehicle
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 乘上交通工具
 
 -   #    以角色非在交通工具之上为前提
 
 -   #--------------------------------------------------------------------------
 
 -   def get_on_vehicle
 
 -     front_x = $game_map.x_with_direction(@x, @direction)
 
 -     front_y = $game_map.y_with_direction(@y, @direction)
 
 -     if $game_map.airship.pos?(@x, @y)       # 判断角色是否与飞船重叠
 
 -       get_on_airship
 
 -       return true
 
 -     elsif $game_map.ship.pos?(front_x, front_y)   # 判断前方是否有大型船
 
 -       get_on_ship
 
 -       return true
 
 -     elsif $game_map.boat.pos?(front_x, front_y)   # 判断前方是否有小型船
 
 -       get_on_boat
 
 -       return true
 
 -     end
 
 -     return false
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 乘上小型船
 
 -   #--------------------------------------------------------------------------
 
 -   def get_on_boat
 
 -     @vehicle_getting_on = true        # 乘上交通工具标志
 
 -     @vehicle_type = 0                 # 设置交通工具类型
 
 -     force_move_forward                # 向前一步
 
 -     @walking_bgm = RPG::BGM::last     # 记忆行走 BGM
 
 -     $game_map.boat.get_on             # 上船处理
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 乘上大型船
 
 -   #--------------------------------------------------------------------------
 
 -   def get_on_ship
 
 -     @vehicle_getting_on = true        # 乘上交通工具标志
 
 -     @vehicle_type = 1                 # 设置交通工具类型
 
 -     force_move_forward                # 向前一步
 
 -     @walking_bgm = RPG::BGM::last     # 记忆行走 BGM
 
 -     $game_map.ship.get_on             # 上船处理
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 乘上飞船
 
 -   #--------------------------------------------------------------------------
 
 -   def get_on_airship
 
 -     @vehicle_getting_on = true        # 乘上交通工具标志
 
 -     @vehicle_type = 2                 # 设置交通工具类型
 
 -     @through = true                   # 允许穿透
 
 -     @walking_bgm = RPG::BGM::last     # 记忆行走 BGM
 
 -     $game_map.airship.get_on          # 上船处理
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 离开交通工具
 
 -   #    以角色在交通工具之上为前提
 
 -   #--------------------------------------------------------------------------
 
 -   def get_off_vehicle
 
 -     if in_airship?                                # 在飞船之上
 
 -       return unless airship_land_ok?(@x, @y)      # 判断是否能降落
 
 -     else                                          # 在大/小型船上
 
 -       front_x = $game_map.x_with_direction(@x, @direction)
 
 -       front_y = $game_map.y_with_direction(@y, @direction)
 
 -       return unless can_walk?(front_x, front_y)   # 判断是否能下船
 
 -     end
 
 -     $game_map.vehicles[@vehicle_type].get_off     # 下船处理
 
 -     if in_airship?                                # 飞船
 
 -       @direction = 2                              # 面向下
 
 -     else                                          # 大/小型船
 
 -       force_move_forward                          # 向前一步
 
 -       @transparent = false                        # 移除透明状态
 
 -     end
 
 -     @vehicle_getting_off = true                   # 开始下船处理
 
 -     @move_speed = 4                               # 回复移动速度
 
 -     @through = false                              # 不允许穿透
 
 -     @walking_bgm.play                             # 回复行走 BGM
 
 -     make_encounter_count                          # 初始化遇敌
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 强迫向前一步
 
 -   #--------------------------------------------------------------------------
 
 -   def force_move_forward
 
 -     @through = true         # 允许穿透
 
 -     move_forward            # 向前一步
 
 -     @through = false        # 不允许穿透
 
 -   end
 
 - end
 
  
- #==============================================================================
 
 - # ■ Scene_Map
 
 - #------------------------------------------------------------------------------
 
 - #  处理地图画面的类。
 
 - #==============================================================================
 
  
- class Scene_Map < Scene_Base
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 开始处理
 
 -   #--------------------------------------------------------------------------
 
 -   def start
 
 -     super
 
 -     $game_map.refresh
 
 -     @spriteset = Spriteset_Map.new
 
 -     @message_window = Window_Message.new
 
 -     @black = Sprite.new
 
 -     #~@rect = {}
 
 -   end
 
 -   ######
 
 -   #视野判定
 
 -   ######
 
 -   def in_view?(ev)
 
 -     add_x = $game_player.x
 
 -     add_y = $game_player.y
 
 -     begin_x = $game_map.display_x - add_x
 
 -     begin_y = $game_map.display_y - add_y
 
 -     end_x = $game_map.display_x + 4352 + add_x
 
 -     end_y = $game_map.display_y + 3328 + add_y
 
 -     limit_x = $game_map.width * 256 - 256 + add_x
 
 -     limit_y = $game_map.height * 256 - 256 + add_y
 
 -     char_x = ev.real_x
 
 -     char_y = ev.real_y
 
 -     if end_x <= limit_x
 
 -       return false if char_x < begin_x or char_x > end_x 
 
 -     end
 
 -     if end_y <= limit_y
 
 -       return false if char_y < begin_y or char_y > end_y
 
 -     end
 
 -     if end_x > limit_x and end_y > limit_y
 
 -       return false if char_x < begin_x and char_x > end_x - limit_x
 
 -       return false if char_y < begin_y and char_y > end_y - limit_y
 
 -     end
 
 -     return true
 
 -   end
 
 -   
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 执行渐变
 
 -   #--------------------------------------------------------------------------
 
 -   def perform_transition
 
 -     if Graphics.brightness == 0       # 战斗後或载入後等
 
 -       fadein(30)
 
 -     else                              # 从菜单中回来等
 
 -       Graphics.transition(15)
 
 -     end
 
 -   end
 
 -   
 
 -   def light(x=0,y=0,h=0,w=0)
 
 -     if ($game_switches[$角色开灯的开光] == false)# and (@black.bitmap != nil)
 
 -       if @black.bitmap != nil
 
 -         @black.bitmap.dispose
 
 -         @black.bitmap = nil
 
 -       end
 
 -       
 
 -       return
 
 -     end
 
 -     #if @black.bitmap == nil
 
 -       @black.bitmap=Bitmap.new(544,416)
 
 -       @black.bitmap.fill_rect(Rect.new(0,0,544,416), Color.new(0,0,0))
 
 -     #end
 
 -     @black.bitmap.clear_rect(Rect.new(x,y,h,w))
 
 - #    for i in @rect
 
 - #      @black.bitmap.clear_rect(Rect.new(i.x,i.y,i.height,i.width))
 
 - #    end
 
 -   end
 
 - #~   def light1(x=0,y=0,h=0,w=0,id)
 
 - #~     @rect[id] = (Rect.new(x,y,h,w))
 
 - #~     for i in @rect
 
 - #~       @black.bitmap.clear_rect(Rect.new(i.x,i.y,i.height,i.width))
 
 - #~     end
 
 - #~   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 结束处理
 
 -   #--------------------------------------------------------------------------
 
 -   def terminate
 
 -     super
 
 -     if $scene.is_a?(Scene_Battle)     # 切换至战斗场景的场合
 
 -       @spriteset.dispose_characters   # 隐藏角色来生成战斗背景
 
 -     end
 
 -     snapshot_for_background
 
 -     @spriteset.dispose
 
 -     @message_window.dispose
 
 -     if $scene.is_a?(Scene_Battle)     # 切换至战斗场景的场合
 
 -       perform_battle_transition       # 执行战斗渐变
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 基本更新处理
 
 -   #--------------------------------------------------------------------------
 
 -   def update_basic
 
 -     Graphics.update                   # 更新游戏画面
 
 -     Input.update                      # 更新输入信息
 
 -     $game_map.update                  # 更新地图
 
 -     @spriteset.update                 # 更新活动块组
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 更新画面
 
 -   #--------------------------------------------------------------------------
 
 -   def update
 
 -     super
 
 -     $game_map.interpreter.update      # 更新解释器
 
 -     $game_map.update                  # 更新地图
 
 -     $game_player.update               # 更新主角
 
 -     $game_system.update               # 更新计时器
 
 -     @spriteset.update                 # 更新活动块组
 
 -     @message_window.update            # 更新信息窗口
 
 -     unless $game_message.visible      # 信息窗口显示中除外
 
 -       update_transfer_player
 
 -       update_encounter
 
 -       update_call_menu
 
 -       update_call_debug
 
 -       update_scene_change
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 淡入画面
 
 -   #     duration : 时间
 
 -   #    如果直接使用 Graphics.fadeout 的话会出现一些状况,如天候效果和远景
 
 -   #    滚动都会被强迫停止,所以用动态的 fade-in 效果会好些。
 
 -   #--------------------------------------------------------------------------
 
 -   def fadein(duration)
 
 -     Graphics.transition(0)
 
 -     for i in 0..duration-1
 
 -       Graphics.brightness = 255 * i / duration
 
 -       update_basic
 
 -     end
 
 -     Graphics.brightness = 255
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 淡出画面
 
 -   #     duration : 时间
 
 -   #    与上面的 fadein 一样,不是直接调用 Graphics.fadein。
 
 -   #--------------------------------------------------------------------------
 
 -   def fadeout(duration)
 
 -     Graphics.transition(0)
 
 -     for i in 0..duration-1
 
 -       Graphics.brightness = 255 - 255 * i / duration
 
 -       update_basic
 
 -     end
 
 -     Graphics.brightness = 0
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 场所移动处理
 
 -   #--------------------------------------------------------------------------
 
 -   def update_transfer_player
 
 -     return unless $game_player.transfer?
 
 -     fade = (Graphics.brightness > 0)
 
 -     fadeout(30) if fade
 
 -     @spriteset.dispose              # 释放活动块组
 
 -     $game_player.perform_transfer   # 执行场所移动
 
 -     $game_map.autoplay              # 自动更改 BGM 和 BGS
 
 -     $game_map.update
 
 -     Graphics.wait(15)
 
 -     @spriteset = Spriteset_Map.new  # 重新生成活动块组
 
 -     fadein(30) if fade
 
 -     Input.update
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 遇敌处理
 
 -   #--------------------------------------------------------------------------
 
 -   def update_encounter
 
 -     return if $game_player.encounter_count > 0        # 检查步数
 
 -     return if $game_map.interpreter.running?          # 判断是否有事件正在执行
 
 -     return if $game_system.encounter_disabled         # 判断是否禁止遇敌
 
 -     troop_id = $game_player.make_encounter_troop_id   # 判断敌人队伍
 
 -     return if $data_troops[troop_id] == nil           # 判断队伍是否无效
 
 -     $game_troop.setup(troop_id)
 
 -     $game_troop.can_escape = true
 
 -     $game_temp.battle_proc = nil
 
 -     $game_temp.next_scene = "battle"
 
 -     preemptive_or_surprise
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断先下手或被偷袭
 
 -   #--------------------------------------------------------------------------
 
 -   def preemptive_or_surprise
 
 -     actors_agi = $game_party.average_agi
 
 -     enemies_agi = $game_troop.average_agi
 
 -     if actors_agi >= enemies_agi
 
 -       percent_preemptive = 5
 
 -       percent_surprise = 3
 
 -     else
 
 -       percent_preemptive = 3
 
 -       percent_surprise = 5
 
 -     end
 
 -     if rand(100) < percent_preemptive
 
 -       $game_troop.preemptive = true
 
 -     elsif rand(100) < percent_surprise
 
 -       $game_troop.surprise = true
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断是否呼叫菜单(按下B键)
 
 -   #--------------------------------------------------------------------------
 
 -   def update_call_menu
 
 -     if Input.trigger?(Input::B)
 
 -       return if $game_map.interpreter.running?        # 判断是否有事件正在执行
 
 -       return if $game_system.menu_disabled            # 判断是否禁止菜单呼叫
 
 -       $game_temp.menu_beep = true                     # 设置音效标志
 
 -       $game_temp.next_scene = "menu"
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 判断是否呼叫DEBUG场景(按下F9键)
 
 -   #--------------------------------------------------------------------------
 
 -   def update_call_debug
 
 -     if $TEST and Input.press?(Input::F9)    # 游戏测试并按下F9
 
 -       $game_temp.next_scene = "debug"
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 执行场景交替
 
 -   #--------------------------------------------------------------------------
 
 -   def update_scene_change
 
 -     return if $game_player.moving?    # 判断主角是否移动中
 
 -     case $game_temp.next_scene
 
 -     when "battle"
 
 -       call_battle
 
 -     when "shop"
 
 -       call_shop
 
 -     when "name"
 
 -       call_name
 
 -     when "menu"
 
 -       call_menu
 
 -     when "save"
 
 -       call_save
 
 -     when "debug"
 
 -       call_debug
 
 -     when "gameover"
 
 -       call_gameover
 
 -     when "title"
 
 -       call_title
 
 -     else
 
 -       $game_temp.next_scene = nil
 
 -     end
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 切换至战斗画面
 
 -   #--------------------------------------------------------------------------
 
 -   def call_battle
 
 -     @spriteset.update
 
 -     Graphics.update
 
 -     $game_player.make_encounter_count
 
 -     $game_player.straighten
 
 -     $game_temp.map_bgm = RPG::BGM.last
 
 -     $game_temp.map_bgs = RPG::BGS.last
 
 -     RPG::BGM.stop
 
 -     RPG::BGS.stop
 
 -     Sound.play_battle_start
 
 -     $game_system.battle_bgm.play
 
 -     $game_temp.next_scene = nil
 
 -     $scene = Scene_Battle.new
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 切换至商店画面
 
 -   #--------------------------------------------------------------------------
 
 -   def call_shop
 
 -     $game_temp.next_scene = nil
 
 -     $scene = Scene_Shop.new
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 切换至名称输入画面
 
 -   #--------------------------------------------------------------------------
 
 -   def call_name
 
 -     $game_temp.next_scene = nil
 
 -     $scene = Scene_Name.new
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 切换至菜单画面
 
 -   #--------------------------------------------------------------------------
 
 -   def call_menu
 
 -     if $game_temp.menu_beep
 
 -       Sound.play_decision
 
 -       $game_temp.menu_beep = false
 
 -     end
 
 -     $game_temp.next_scene = nil
 
 -     $scene = Scene_Menu.new
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 切换至存档画面
 
 -   #--------------------------------------------------------------------------
 
 -   def call_save
 
 -     $game_temp.next_scene = nil
 
 -     $scene = Scene_File.new(true, false, true)
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 切换至DEBUG画面
 
 -   #--------------------------------------------------------------------------
 
 -   def call_debug
 
 -     Sound.play_decision
 
 -     $game_temp.next_scene = nil
 
 -     $scene = Scene_Debug.new
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 切换至游戏结束画面
 
 -   #--------------------------------------------------------------------------
 
 -   def call_gameover
 
 -     $game_temp.next_scene = nil
 
 -     $scene = Scene_Gameover.new
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 切换至标题画面
 
 -   #--------------------------------------------------------------------------
 
 -   def call_title
 
 -     $game_temp.next_scene = nil
 
 -     $scene = Scene_Title.new
 
 -     fadeout(60)
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 执行战斗渐变
 
 -   #--------------------------------------------------------------------------
 
 -   def perform_battle_transition
 
 -     Graphics.transition(80, "Graphics/System/BattleStart", 80)
 
 -     Graphics.freeze
 
 -   end
 
 - end
 
 
  复制代码 |   
 
 
 
 |