赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 1155 |
最后登录 | 2012-9-29 |
在线时间 | 36 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 36 小时
- 注册时间
- 2010-9-3
- 帖子
- 54
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
用事件将地图(100)开关关闭后,如何再将小地图显示出来???- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
- #==============================================================================
- # ■ 全景地图显示小地图
- #########################
- # by sphinger #
- #########################
- #==============================================================================
- #==============================================================================
- # □ 前期定义
- #==============================================================================
- module PLAN_Map_Window
- WIN_X = 440 # 窗口的初始 X 座標
- WIN_Y = 0 # 窗口的初始 Y 座標
- WIN_WIDTH = 200 # 地图的宽度
- WIN_HEIGHT = 150 # 地图的高度
- ZOOM = 4.0 # 地图的放缩比例
- ZOOMP = 1 # 小地图上角色的缩放(1为图片原来大小,往大调节时图片变小)
- SHOWPLAYER = false # 是否显示角色,当为true时,小地图将显示角色为false时显示兰色的标记
- PLAYCW = 4 #当使用上面的显示角色时,这个用来设置,角色的横向帧数
- PLAYCH = 4 #当使用上面的显示角色时,这个用来设置,角色的综向帧数
- WINDOWSKIN = "" # 自定义地图窗口素材,如果留空则是默认的
- ON_OFF_KEY = Input::A # 打开地图的按钮,A就是键盘的Z键
- SWITCH = 100 # 禁用地图功能的开关,默认这个就是打开100号开关则禁止
- # 使用地图功能,关闭则可以使用地图功能
- WINDOW_MOVE = true # 是否可以自动改变窗口位置(true:可改变, false:固定)
-
- OVER_X = 440 # 自动改变后窗口的位置x
- OVER_Y = 480 - WIN_HEIGHT #自动改变后窗口的位置y
- OPACITY = 192 # 窗口的透明度
- C_OPACITY = 192 # 地图的透明度
- VISIBLE = true # 最初是否可见
- end
- #==============================================================================
- # ■ Game_Temp
- #==============================================================================
- class Game_Temp
- attr_accessor :map_visible # 地图的表示状態
- alias plan_map_window_initialize initialize
- def initialize
- plan_map_window_initialize
- @map_visible = true
- end
- end
- #==============================================================================
- # ■ Scene_Map
- #==============================================================================
- class Scene_Map
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- alias plan_map_window_main main
- def main
- @map_window = Window_Map.new
- @map_window.visible = $game_temp.map_visible
- plan_map_window_main
- @map_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- alias plan_map_window_update update
- def update
- $game_temp.map_visible = @map_window.visible
- plan_map_window_update
- unless $game_switches[PLAN_Map_Window::SWITCH]
- #unless $game_switches[PLAN_Map_Window::SWITCH]
- if Input.trigger?(PLAN_Map_Window::ON_OFF_KEY)
- if @map_window.visible
- @map_window.visible = false
- else
- @map_window.visible = true
- end
- end
- else
- if @map_window.visible
- @map_window.visible = false
- end
- end
- if @map_window.visible
- @map_window.update
- end
- end
- #--------------------------------------------------------------------------
- # ● 场所移动的变化
- #--------------------------------------------------------------------------
- alias plan_map_window_transfer_player transfer_player
- def transfer_player
- visible = @map_window.visible
- @map_window.visible = false
- plan_map_window_transfer_player
- @map_window.dispose
- @map_window = Window_Map.new
- @map_window.visible = visible
- end
- end
- #==============================================================================
- # ■ Window_Map
- #==============================================================================
- class Window_Map < Window_Base
- #--------------------------------------------------------------------------
- # ● 初始化
- #--------------------------------------------------------------------------
- def initialize
- x = PLAN_Map_Window::WIN_X
- y = PLAN_Map_Window::WIN_Y
- w = PLAN_Map_Window::WIN_WIDTH
- h = PLAN_Map_Window::WIN_HEIGHT
- super(x, y, w, h)
- unless PLAN_Map_Window::WINDOWSKIN.empty?
- self.windowskin = RPG::Cache.windowskin(PLAN_Map_Window::WINDOWSKIN)
- end
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = PLAN_Map_Window::OPACITY
- self.contents_opacity = PLAN_Map_Window::C_OPACITY
- @old_real_x = $game_player.real_x
- @old_real_y = $game_player.real_y
- @all_map = make_all_map
- self.visible = PLAN_Map_Window::VISIBLE
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 缩小图做成
- #--------------------------------------------------------------------------
- def make_all_map
- all_map = RPG::Cache.icon("地图" + $game_map.map_id.to_s)
- cw = $game_map.width * 32
- ch = $game_map.height * 32
- src_rect = Rect.new(0, 0, cw, ch)
- self.contents.blt(0 , 0, all_map, src_rect)
- w = ($game_map.width / PLAN_Map_Window::ZOOM) * 32
- h = ($game_map.height / PLAN_Map_Window::ZOOM) * 32
- ret_bitmap = Bitmap.new(w, h)
- src_rect = Rect.new(0, 0, all_map.width, all_map.height)
- dest_rect = Rect.new(0, 0, ret_bitmap.width, ret_bitmap.height)
- ret_bitmap.stretch_blt(dest_rect, all_map, src_rect)
- all_map.dispose
- return ret_bitmap
- end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- one_tile_size = 32 / PLAN_Map_Window::ZOOM
- x = $game_player.real_x - 128 * (self.contents.width / one_tile_size) / 2
- y = $game_player.real_y - 128 * (self.contents.height / one_tile_size) / 2
- x = x * one_tile_size / 128
- y = y * one_tile_size / 128
- half_width = self.contents.width * 128 / 2
- rest_width = ($game_map.width * 128 - $game_player.real_x) * one_tile_size
- rev_x = 0
- if @all_map.width < self.contents.width
- rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
- rev_x -= (self.contents.width - @all_map.width) / 2
- x += rev_x
- elsif half_width > $game_player.real_x * one_tile_size
- rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
- x += rev_x
- elsif half_width > rest_width
- rev_x = -((half_width - rest_width) / 128)
- x += rev_x
- end
- half_height = self.contents.height * 128 / 2
- rest_height = ($game_map.height * 128 - $game_player.real_y) * one_tile_size
- rev_y = 0
- if @all_map.height < self.contents.height
- rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
- rev_y -= (self.contents.height - @all_map.height) / 2
- y += rev_y
- elsif half_height > $game_player.real_y * one_tile_size
- rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
- y += rev_y
- elsif half_height > rest_height
- rev_y = -((half_height - rest_height) / 128)
- y += rev_y
- end
- src_rect = Rect.new(x, y, self.contents.width, self.contents.height)
- self.contents.blt(0, 0, @all_map, src_rect)
- if PLAN_Map_Window::WINDOW_MOVE == true
- wr = PLAN_Map_Window::WIN_X + self.width
- wl = PLAN_Map_Window::WIN_X
- ht = PLAN_Map_Window::WIN_Y
- he = PLAN_Map_Window::WIN_Y + self.height
- if $game_player.screen_x >= wl and $game_player.screen_x <= wr
- if $game_player.screen_y >= ht and $game_player.screen_y <= he
- self.x = PLAN_Map_Window::OVER_X
- self.y = PLAN_Map_Window::OVER_Y
- else
- self.x = PLAN_Map_Window::WIN_X
- self.y = PLAN_Map_Window::WIN_Y
- end
- else
- self.x = PLAN_Map_Window::WIN_X
- self.y = PLAN_Map_Window::WIN_Y
- end
- end
- if $game_party.actors.size > 0
- actor = $game_party.actors[0]
- if PLAN_Map_Window::SHOWPLAYER
- bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
- width = bitmap.width / PLAN_Map_Window::PLAYCW
- height = bitmap.height / PLAN_Map_Window::PLAYCH
- src_rect = Rect.new(0, 0, width, height)
- w = width / PLAN_Map_Window::ZOOM
- h = height / PLAN_Map_Window::ZOOM
- else
- bitmap = RPG::Cache.icon("方向" + $game_player.direction.to_s)
- width = bitmap.width / PLAN_Map_Window::ZOOMP
- height = bitmap.height / PLAN_Map_Window::ZOOMP
- src_rect = Rect.new(0, 0, width, height)
- w = width
- h = height
- end
- x = self.contents.width / 2 - w / 2 + one_tile_size / 2 - rev_x
- y = self.contents.height / 2 - h / 2 - rev_y
- dest_rect = Rect.new(x, y, w, h)
- self.contents.stretch_blt(dest_rect, bitmap, src_rect)
- end
- end
- #--------------------------------------------------------------------------
- # ● 更新
- #--------------------------------------------------------------------------
- def update
- super
- if @old_real_x != $game_player.real_x or @old_real_y != $game_player.real_y
- @old_real_x = $game_player.real_x
- @old_real_y = $game_player.real_y
- refresh
- end
- end
- #--------------------------------------------------------------------------
- # ● 释放
- #--------------------------------------------------------------------------
- def dispose
- super
- @all_map.dispose
- end
- end
- #==============================================================================
- # 本脚本来自www.66RPG.com,使用和转载请保留此信息
- #==============================================================================
复制代码 |
评分
-
查看全部评分
|