#------------------------------------
# 简易格子地图 by 灯笼菜刀酱
MAP_SWI_ID = 1 #地图开关ID
MAP_COPY = 1 #重复地图区别变量ID
#====================================================================
$platmap = []
def 打开地图(number)
case number
#===============================================================
#地图设置,
when 0
地图 = "map1" #地图图片名称
#地图每个格子坐标 [x,y]=> 对应的地图ID. ↓可以换行,逗号别忘
区号 = {[1,1]=>1.00,[2,1]=> 2,[2,2]=>3,[2,3]=>3,
[2,4]=>3,[3,4]=>1.01,[4,4]=>4,[4,5]=>4,[5,4]=>4,[5,5]=>4}
#需要不同的地图,就在下面添加
#when 1
#地图 = XXX
#区号 = XXX
#然后事件脚本写: 打开地图(1) 就可以打开新的地图,要关掉地图 事件脚本写 : 关闭地图
#===============================================================
else
地图 = nil
区号 = nil
end
$platmap.push(地图)
$platmap.push(区号)
$mapshow = Window_plat.new
end
def 关闭地图
if $mapshow != nil
$mapshow.dispose
$mapshow = nil
end
end
class Window_plat < Window_Base
def initialize
super(0, 0, 160, 120)
self.contents = Bitmap.new(width - 32, height - 32)
@mapid = 0
setup if $platmap[0] != nil
end
def setup
self.contents = Bitmap.new("Graphics/gameovers/" + $platmap[0])
@mx = self.contents.width / 16
@my = self.contents.height / 16
refresh
end
def refresh
self.contents.clear
bitmap = RPG::Cache.gameover($platmap[0])
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(0, 0, bitmap, src_rect)
x,y = 0,0
loop do
铺块(x,y)
if x < @mx
x += 1
elsif y < @my
y += 1
x = 0
elsif x == @mx and y == @my
break
end
end
end
def 铺块(x,y)
return if $platmap[1] == nil
b = $game_map.map_id
if $platmap[1][[x,y]].is_a?(Float)
f = $platmap[1][[x,y]] * 100
if Integer(f) / 100 == b and Integer(f) % 100 == $game_variables[MAP_COPY]
self.ox = x*16 - 57
self.oy = y*16 - 36
return
end
elsif $platmap[1][[x,y]] == b
self.ox = x*16 - 57
self.oy = y*16 - 36
return
end
bitmap = RPG::Cache.gameover("outsize")
src_rect = Rect.new(0, 0, 16, 16)
self.contents.blt(x*16, y*16, bitmap, src_rect,128)
end
def update
if @mapid != $game_map.map_id and $platmap[0] != nil
setup
@mapid = $game_map.map_id
end
end
end
#------------------------------------
# 简易格子地图 by 灯笼菜刀酱
MAP_SWI_ID = 1 #地图开关ID
MAP_COPY = 1 #重复地图区别变量ID
#====================================================================
$platmap = []
def 打开地图(number)
case number
#===============================================================
#地图设置,
when 0
地图 = "map1" #地图图片名称
#地图每个格子坐标 [x,y]=> 对应的地图ID. ↓可以换行,逗号别忘
区号 = {[1,1]=>1.00,[2,1]=> 2,[2,2]=>3,[2,3]=>3,
[2,4]=>3,[3,4]=>1.01,[4,4]=>4,[4,5]=>4,[5,4]=>4,[5,5]=>4}
#需要不同的地图,就在下面添加
#when 1
#地图 = XXX
#区号 = XXX
#然后事件脚本写: 打开地图(1) 就可以打开新的地图,要关掉地图 事件脚本写 : 关闭地图
#===============================================================
else
地图 = nil
区号 = nil
end
$platmap.push(地图)
$platmap.push(区号)
$mapshow = Window_plat.new
end
def 关闭地图
if $mapshow != nil
$mapshow.dispose
$mapshow = nil
end
end
class Window_plat < Window_Base
def initialize
super(0, 0, 160, 120)
self.contents = Bitmap.new(width - 32, height - 32)
@mapid = 0
setup if $platmap[0] != nil
end
def setup
self.contents = Bitmap.new("Graphics/gameovers/" + $platmap[0])
@mx = self.contents.width / 16
@my = self.contents.height / 16
refresh
end
def refresh
self.contents.clear
bitmap = RPG::Cache.gameover($platmap[0])
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(0, 0, bitmap, src_rect)
x,y = 0,0
loop do
铺块(x,y)
if x < @mx
x += 1
elsif y < @my
y += 1
x = 0
elsif x == @mx and y == @my
break
end
end
end
def 铺块(x,y)
return if $platmap[1] == nil
b = $game_map.map_id
if $platmap[1][[x,y]].is_a?(Float)
f = $platmap[1][[x,y]] * 100
if Integer(f) / 100 == b and Integer(f) % 100 == $game_variables[MAP_COPY]
self.ox = x*16 - 57
self.oy = y*16 - 36
return
end
elsif $platmap[1][[x,y]] == b
self.ox = x*16 - 57
self.oy = y*16 - 36
return
end
bitmap = RPG::Cache.gameover("outsize")
src_rect = Rect.new(0, 0, 16, 16)
self.contents.blt(x*16, y*16, bitmap, src_rect,128)
end
def update
if @mapid != $game_map.map_id and $platmap[0] != nil
setup
@mapid = $game_map.map_id
end
end
end