小地图脚本(mini map with out bitmap file)
give me the credit if you can!1.5 脚本 的 Screen shot:
http://img433.imageshack.us/img433/9434/untitled9vf.th.png
用法:
To set the type of blip in the map:
让一个 event 变成在小地图上的 Enemy,将事件添加一个注释,内容为 "enemy"
让一个 event 变成在小地图上的 Event,将事件添加桓鲎⑹停?谌菸?"event"
让一个 event 变成在小地图上的 allied (or NPC),将事件添加一个注释,内容为 "allied"
让一个 event 变成在小地图上的 SavePoint,将事件添加一个注释,内容为 "savepoint"
让一个 event 变成在小地图上的 Teleport,将事件添加一个注释,内容为 "teleport"
让一个 event 变成在小地图上的 Chest,将事件添加一个注释,内容为 "chest"
自己改这些
#--------------------------------------------------------------------------class Game_Systemattr_accessor :minimap_visible attr_accessor :minimap_corneralias initialize_minimap initializedef initialize @minimap_visible = true # 一开始就显示小地图 @minimap_corner = 1 # 小地图的位置 (1,2,3,4) initialize_minimapendend复制代码
在运行时改变小地图
显示小地图
$game_system.minimap_visible = true
不显示小地图
$game_system.minimap_visible = false
换位置
$game_system.minimap_corner = 1 # 2, 3, 4
使用自己的 border, 必须改变一些 (在 Spriteset_MiniMap 内)
bt = 25# the border size at the top bl = 5# the border size at the leftbr = 5# the border size at the rightbb= 5 # the border size at the bottom复制代码
脚本在楼下。
有一些词语我不会翻译,大家可以帮我改吗?
#==============================================================================
# * Spriteset_MiniMap ver 1.5
#------------------------------------------------------------------------------
# Fanha Giang, 2005/11/18
#==============================================================================
class Spriteset_MiniMap
def initialize()
@zoom = 0.25
@size = 32
@dsize = @size * @zoom
@coner = $game_system.minimap_corner
# the viewport for the mini map and the blips
@viewport = Viewport.new(0, 0, 640, 480)
@viewport.z = 6000
# sprite of minimap
@minimap = Sprite_MiniMap.new(@viewport, @dsize)
# bitmap of the minimap
@bitmap = Bitmap.new($game_map.width * @dsize, $game_map.height * @dsize)
# drawer object
@draw_minimap = Draw_MiniBitmap.new(0, @bitmap, 28, 23)
@draw_minimap.map_data = $game_map.data
@draw_minimap.priorities = $game_map.priorities
@draw_minimap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
@draw_minimap.autotiles = RPG::Cache.autotile($game_map.autotile_names)
end
# the blips in the map
@mini_sprites = []
for event in $game_map.events.values
@mini_sprites.push(Sprite_Mini_Character.new(@viewport, @zoom, 1 , event))
end
@mini_sprites.push(Sprite_Mini_Character.new(@viewport, @zoom, 0, $game_player))
# viewport of the border and something else addon
@bviewport = Viewport.new(0, 0, 640, 480)
@bviewport.z = 6001
# init the border
@border = Sprite.new(@bviewport)
@border.bitmap = RPG::Cache.picture("border")
# init the map name
@mapname = Sprite.new(@bviewport)
@mapname.x = 30
@mapname.y = 3
@mapname.bitmap = Bitmap.new(200,25)
@mapname.bitmap.font.name = "Tahoma"
@mapname.bitmap.font.size = 21
@mapname.bitmap.font.color = Color.new(255, 0, 0, 255)
@mapname.bitmap.draw_text(@mapname.bitmap.rect, $game_map.name.to_s, 1)
update_viewport
update
end
#--------------------------------------------------------------------------
# - Release
#--------------------------------------------------------------------------
def dispose
# dispose the bitmap
(!@bitmap.nil?) ? @bitmap.dispose : nil
# dispose the mini map sprite
@minimap.dispose
# dispose the blips
for sprite in @mini_sprites
sprite.dispose
end
# dispose the map name
@mapname.bitmap.dispose
@mapname.dispose
#dispose the border
@border.bitmap.dispose
@border.dispose
# dispose the viewport
@viewport.dispose
@bviewport.dispose
end
#--------------------------------------------------------------------------
# - Frame renewal
#--------------------------------------------------------------------------
def update
# draw the map
x1 = (($game_map.display_x - 64) / 128 - 4).to_i
y1 = ($game_map.display_y / 128 - 4).to_i
@draw_minimap.draw(x1,y1)
# update the sprites
@minimap.update(@bitmap)
for sprite in @mini_sprites
sprite.update
end
if@coner != $game_system.minimap_corner
@coner = $game_system.minimap_corner
update_viewport
end
@viewport.visible = $game_system.minimap_visible
@bviewport.visible = $game_system.minimap_visible
end
#--------------------------------------------------------------------------
def update_viewport
width = (640 + @size * 4) * @zoom
height = (480 + @size * 4) * @zoom
bt = 25
bl = 39
br = 39
bb= 5
case $game_system.minimap_corner
when 1
@viewport.rect.set(0 + bl, 0 + bt, width, height)
@bviewport.rect.set(0 , 0 , width + bl + br, height + bt + bb)
when 2
@viewport.rect.set(640 - width - br, 0 + bt, width, height)
@bviewport.rect.set(640 - width - br - bl, 0 , width + bl + br, height + bt + bb)
when 3
@viewport.rect.set(0 + bl, 480 - height - bb, width, height)
@bviewport.rect.set(0 , 480 - height - bb - bt , width + bl + br, height + bt + bb)
when 4
@viewport.rect.set(640 - width- br, 480 - height - bb, width, height)
@bviewport.rect.set(640 - width - br - bl , 480 - height - bb - bt , width + bl + br, height + bt + bb)
end
end
#---------------------------------------------------------------------------------------
end
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
class Game_System
attr_accessor :minimap_visible # to set the minimap visible or not
attr_accessor :minimap_corner # to set the corner of the minimap 1, 2, 3, 4
alias initialize_minimap initialize
def initialize
@minimap_visible = false
@minimap_corner = 1
initialize_minimap
end
end
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
class Game_Map
# add by the script mini map of Fanha Giang
def name
text = $map_infos[@map_id].clone
text.gsub!(/\\\[(+)\]/) do
$game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
end
return text
end
# end of the add by Fanha Giang
end
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
class Scene_Title
# add by the script mini map of Fanha Giang
def load_map_infos
$map_infos = load_data("Data/MapInfos.rxdata")
for key in $map_infos.keys
$map_infos = $map_infos.name
end
end
# end add
end
#--------------------------------------------------------------------------
#--------------------------------------------------------------------------
本帖来自P1论坛作者Fanha99,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg. blue/forum.php?mod=viewthread&tid=2321若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页:
[1]