设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2269|回复: 4
打印 上一主题 下一主题

[已经过期] 怎么可以远景图显示小地图用开关打开

[复制链接]

Lv1.梦旅人

梦石
0
星屑
65
在线时间
391 小时
注册时间
2008-11-7
帖子
352
跳转到指定楼层
1
发表于 2010-7-12 13:55:44 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #==============================================================================
  5. # ■ 全景地图显示小地图
  6. #########################
  7. # by sphinger #
  8. #########################
  9. #==============================================================================
  10. #==============================================================================
  11. # □ 前期定义
  12. #==============================================================================
  13. module PLAN_Map_Window
  14. WIN_X = -1 # 窗口的初始 X 座標
  15. WIN_Y = 298 # 窗口的初始 Y 座標
  16. WIN_WIDTH = 200 # 地图的宽度
  17. WIN_HEIGHT = 150 # 地图的高度
  18. ZOOM = 4.0 # 地图的放缩比例
  19. ZOOMP = 1 # 小地图上角色的缩放(1为图片原来大小,往大调节时图片变小)
  20. SHOWPLAYER = true # 是否显示角色,当为true时,小地图将显示角色为false时显示兰色的标记
  21. PLAYCW = 8 #当使用上面的显示角色时,这个用来设置,角色的横向帧数
  22. PLAYCH = 8 #当使用上面的显示角色时,这个用来设置,角色的综向帧数
  23. WINDOWSKIN = "仙3窗口_98387984" # 自定义地图窗口素材,如果留空则是默认的

  24. ON_OFF_KEY = Input::A # 打开地图的按钮,A就是键盘的Z键

  25. SWITCH = 24 # 禁用地图功能的开关,默认这个就是打开100号开关则禁止
  26. # 使用地图功能,关闭则可以使用地图功能

  27. WINDOW_MOVE = true # 是否可以自动改变窗口位置(true:可改变, false:固定)

  28. OVER_X = 440 # 自动改变后窗口的位置x
  29. OVER_Y = 480 - WIN_HEIGHT #自动改变后窗口的位置y

  30. OPACITY = 192 # 窗口的透明度
  31. C_OPACITY = 192 # 地图的透明度
  32. VISIBLE = false # 最初是否可见
  33. end

  34. #==============================================================================
  35. # ■ Game_Temp
  36. #==============================================================================
  37. class Game_Temp
  38. attr_accessor :map_visible # 地图的表示状態
  39. alias plan_map_window_initialize initialize
  40. def initialize
  41. plan_map_window_initialize
  42. @map_visible = false
  43. end
  44. end
  45. #==============================================================================
  46. # ■ Scene_Map
  47. #==============================================================================
  48. class Scene_Map
  49. #------------------------------------
  50. # ● 主处理
  51. #------------------------------------
  52. alias plan_map_window_main main
  53. def main
  54. @map_window = Window_Map.new
  55. @map_window.visible = $game_temp.map_visible
  56. plan_map_window_main
  57. @map_window.dispose
  58. end
  59. #------------------------------------
  60. # ● 更新
  61. #------------------------------------
  62. alias plan_map_window_update update
  63. def update
  64. $game_temp.map_visible = @map_window.visible
  65. plan_map_window_update
  66. unless $game_switches[PLAN_Map_Window::SWITCH]
  67. if Input.trigger?(PLAN_Map_Window::ON_OFF_KEY)
  68. if @map_window.visible
  69. @map_window.visible = false
  70. else
  71. @map_window.visible = true
  72. end
  73. end
  74. else
  75. if @map_window.visible
  76. @map_window.visible = false
  77. end
  78. end
  79. if @map_window.visible
  80. @map_window.update
  81. end
  82. end
  83. #------------------------------------
  84. # ● 场所移动的变化
  85. #------------------------------------
  86. alias plan_map_window_transfer_player transfer_player
  87. def transfer_player
  88. visible = @map_window.visible
  89. @map_window.visible = false
  90. plan_map_window_transfer_player
  91. @map_window.dispose
  92. @map_window = Window_Map.new
  93. @map_window.visible = visible
  94. end
  95. end
  96. #==============================================================================
  97. # ■ Window_Map
  98. #==============================================================================
  99. class Window_Map < Window_Base
  100. #------------------------------------
  101. # ● 初始化
  102. #------------------------------------
  103. def initialize
  104. x = PLAN_Map_Window::WIN_X
  105. y = PLAN_Map_Window::WIN_Y
  106. w = PLAN_Map_Window::WIN_WIDTH
  107. h = PLAN_Map_Window::WIN_HEIGHT
  108. super(x, y, w, h)
  109. unless PLAN_Map_Window::WINDOWSKIN.empty?
  110. self.windowskin = RPG::Cache.windowskin(PLAN_Map_Window::WINDOWSKIN)
  111. end
  112. self.contents = Bitmap.new(width - 32, height - 32)
  113. self.opacity = PLAN_Map_Window::OPACITY
  114. self.contents_opacity = PLAN_Map_Window::C_OPACITY
  115. @old_real_x = $game_player.real_x
  116. @old_real_y = $game_player.real_y
  117. @all_map = make_all_map
  118. self.visible = PLAN_Map_Window::VISIBLE
  119. refresh
  120. end
  121. #------------------------------------
  122. # ● 缩小图做成
  123. #------------------------------------
  124. def make_all_map
  125. all_map = RPG::Cache.icon("地图" + $game_map.map_id.to_s)
  126. cw = $game_map.width * 32
  127. ch = $game_map.height * 32
  128. src_rect = Rect.new(0, 0, cw, ch)
  129. self.contents.blt(0 , 0, all_map, src_rect)
  130. w = ($game_map.width / PLAN_Map_Window::ZOOM) * 32
  131. h = ($game_map.height / PLAN_Map_Window::ZOOM) * 32
  132. ret_bitmap = Bitmap.new(w, h)
  133. src_rect = Rect.new(0, 0, all_map.width, all_map.height)
  134. dest_rect = Rect.new(0, 0, ret_bitmap.width, ret_bitmap.height)
  135. ret_bitmap.stretch_blt(dest_rect, all_map, src_rect)
  136. all_map.dispose
  137. return ret_bitmap
  138. end
  139. #------------------------------------
  140. # ● 刷新
  141. #------------------------------------
  142. def refresh
  143. self.contents.clear
  144. one_tile_size = 32 / PLAN_Map_Window::ZOOM
  145. x = $game_player.real_x - 128 * (self.contents.width / one_tile_size) / 2
  146. y = $game_player.real_y - 128 * (self.contents.height / one_tile_size) / 2
  147. x = x * one_tile_size / 128
  148. y = y * one_tile_size / 128
  149. half_width = self.contents.width * 128 / 2
  150. rest_width = ($game_map.width * 128 - $game_player.real_x) * one_tile_size
  151. rev_x = 0
  152. if @all_map.width < self.contents.width
  153. rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
  154. rev_x -= (self.contents.width - @all_map.width) / 2
  155. x += rev_x
  156. elsif half_width > $game_player.real_x * one_tile_size
  157. rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
  158. x += rev_x
  159. elsif half_width > rest_width
  160. rev_x = -((half_width - rest_width) / 128)
  161. x += rev_x
  162. end
  163. half_height = self.contents.height * 128 / 2
  164. rest_height = ($game_map.height * 128 - $game_player.real_y) * one_tile_size
  165. rev_y = 0
  166. if @all_map.height < self.contents.height
  167. rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
  168. rev_y -= (self.contents.height - @all_map.height) / 2
  169. y += rev_y
  170. elsif half_height > $game_player.real_y * one_tile_size
  171. rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
  172. y += rev_y
  173. elsif half_height > rest_height
  174. rev_y = -((half_height - rest_height) / 128)
  175. y += rev_y
  176. end
  177. src_rect = Rect.new(x, y, self.contents.width, self.contents.height)
  178. self.contents.blt(0, 0, @all_map, src_rect)
  179. if PLAN_Map_Window::WINDOW_MOVE == true
  180. wr = PLAN_Map_Window::WIN_X + self.width
  181. wl = PLAN_Map_Window::WIN_X
  182. ht = PLAN_Map_Window::WIN_Y
  183. he = PLAN_Map_Window::WIN_Y + self.height
  184. if $game_player.screen_x >= wl and $game_player.screen_x <= wr
  185. if $game_player.screen_y >= ht and $game_player.screen_y <= he
  186. self.x = PLAN_Map_Window::OVER_X
  187. self.y = PLAN_Map_Window::OVER_Y
  188. else
  189. self.x = PLAN_Map_Window::WIN_X
  190. self.y = PLAN_Map_Window::WIN_Y
  191. end
  192. else
  193. self.x = PLAN_Map_Window::WIN_X
  194. self.y = PLAN_Map_Window::WIN_Y
  195. end
  196. end
  197. if $game_party.actors.size > 0
  198. actor = $game_party.actors[0]
  199. if PLAN_Map_Window::SHOWPLAYER
  200. bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  201. width = bitmap.width / PLAN_Map_Window::PLAYCW
  202. height = bitmap.height / PLAN_Map_Window::PLAYCH
  203. src_rect = Rect.new(0, 0, width, height)
  204. w = width / PLAN_Map_Window::ZOOM
  205. h = height / PLAN_Map_Window::ZOOM
  206. else
  207. bitmap = RPG::Cache.icon("方向" + $game_player.direction.to_s)
  208. width = bitmap.width / PLAN_Map_Window::ZOOMP
  209. height = bitmap.height / PLAN_Map_Window::ZOOMP
  210. src_rect = Rect.new(0, 0, width, height)
  211. w = width
  212. h = height
  213. end
  214. x = self.contents.width / 2 - w / 2 + one_tile_size / 2 - rev_x
  215. y = self.contents.height / 2 - h / 2 - rev_y
  216. dest_rect = Rect.new(x, y, w, h)
  217. self.contents.stretch_blt(dest_rect, bitmap, src_rect)
  218. end
  219. end
  220. #------------------------------------
  221. # ● 更新
  222. #------------------------------------
  223. def update
  224. super
  225. if @old_real_x != $game_player.real_x or @old_real_y != $game_player.real_y
  226. @old_real_x = $game_player.real_x
  227. @old_real_y = $game_player.real_y
  228. refresh
  229. end
  230. end
  231. #------------------------------------
  232. # ● 释放
  233. #------------------------------------
  234. def dispose
  235. super
  236. @all_map.dispose
  237. end
  238. end

  239. #==============================================================================
  240. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  241. #==============================================================================
复制代码
这个脚本是用按键打开的
我想用开关打开
比如打开开关1小地图就出现
关闭开关1小地图就消失
请问该怎么修改?
2024到此一游
《仙剑奇侠传四外传卷云残曦碎星海》2012-2024跨越12年的制作

Lv1.梦旅人

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-6-26
帖子
279
2
发表于 2010-7-12 14:09:28 | 只看该作者
加Q849797000
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
65
在线时间
391 小时
注册时间
2008-11-7
帖子
352
3
 楼主| 发表于 2010-7-13 09:24:26 | 只看该作者
在线等·······
2024到此一游
《仙剑奇侠传四外传卷云残曦碎星海》2012-2024跨越12年的制作
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
230
在线时间
24 小时
注册时间
2008-8-2
帖子
128
4
发表于 2010-7-13 09:48:37 | 只看该作者
第74行,看到这个了吗?
  1. if Input.trigger?(PLAN_Map_Window::ON_OFF_KEY)
复制代码
这是判断按键的脚本,改成:
  1. if $game_switches[1]
复制代码
就行了。
GRESK
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
65
在线时间
391 小时
注册时间
2008-11-7
帖子
352
5
 楼主| 发表于 2010-7-13 10:10:14 | 只看该作者
为什么改完以后总闪呢?
2024到此一游
《仙剑奇侠传四外传卷云残曦碎星海》2012-2024跨越12年的制作
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-6-18 08:38

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表