Войти на сайт
×
Правила раздела:
1 Задавайте конкретные вопросы. Для болтовни есть свободный раздел.
2 По возможности давайте конкретные ответы.
3 Один вопрос=одна тема. Если хотите задать ещё вопрос, то начинайте новую тему.
4 Название темы должно составлять сам вопрос, и быть максимально конкретным. Рекомендуется начинать тему словами "Как", "Что", "Почему". А первый пост повторяет вопрос и даёт расширенные сведения.
5 Рекомендуется указывать версию мейкера (2000, 2003, RMXP, RMVX, ACE, IGM, и.т.д.. Это важно, и всё равно ведь спросят.
6 Темы "Пара вопросов", "Помогите", и подобные им - самый лёгкий путь к бану.
7 Поиск находится вверху справа.
А. Названия подразделов этого раздела уточняются. Советы принимаются.
1 Задавайте конкретные вопросы. Для болтовни есть свободный раздел.
2 По возможности давайте конкретные ответы.
3 Один вопрос=одна тема. Если хотите задать ещё вопрос, то начинайте новую тему.
4 Название темы должно составлять сам вопрос, и быть максимально конкретным. Рекомендуется начинать тему словами "Как", "Что", "Почему". А первый пост повторяет вопрос и даёт расширенные сведения.
5 Рекомендуется указывать версию мейкера (2000, 2003, RMXP, RMVX, ACE, IGM, и.т.д.. Это важно, и всё равно ведь спросят.
6 Темы "Пара вопросов", "Помогите", и подобные им - самый лёгкий путь к бану.
7 Поиск находится вверху справа.
А. Названия подразделов этого раздела уточняются. Советы принимаются.
ТЕМА: minimap vx
minimap vx 13 года 8 мес. назад #43254
|
Собственно проблема с мини картой, если создовать карту размером больше 380на380 выдает ошибку в 221 строке мини карты, если меньше всё работает прекрасно. Возможно ли увеличить её, или размер останется таким?
ВНИМАНИЕ: Спойлер! [ Нажмите, чтобы развернуть ][ Нажмите, чтобы скрыть ] #===============================================================
# ● [VX] ◦ MiniMap ◦ □
# * Plug N Play Minimap (Don't need image~) *
#--------------------------------------------------------------
# ◦ by Woratana [[email protected]]
# ◦ Thaiware RPG Maker Community
# ◦ Released on: 09/06/2008
# ◦ Version: 1.0
#--------------------------------------------------------------
# ◦ Credit: KGC for XP MiniMap Script,
# this script can't be done without his MiniMap.
#--------------------------------------------------------------
module MiniMap
#===========================================================================
# [START] MINIMAP SCRIPT SETUP PART
#---------------------------------------------------------------------------
SWITCH_NO_MINIMAP = 100 # Turn ON this switch to NOT SHOW minimap
MAP_RECT = [410, 300, 100, 100] # Minimap size and position
# [X, Y, Width, Height]
# You can change it in game, by call script:
# $game_system.minimap = [X, Y, Width, Height]
MAP_Z = 0 # Minimap's Z-coordinate
# Increase this number if there is problem that minimap show below some objects.
GRID_SIZE = 5 # Minimap's grid size. Recommend to use more than 3.
MINIMAP_BORDER_COLOR = Color.new(0, 0, 255, 160) # Minimap's border color
# Color.new(Red, Green, Blue, Opacity)
MINIMAP_BORDER_SIZE = 2 # Minimap's border size
FOREGROUND_COLOR = Color.new(224, 224, 255, 160) # Passable tile color
BACKGROUND_COLOR = Color.new(0, 0, 0, 160) # Unpassable tile color
USE_OUTLINE_PLAYER = true # Draw outline around player in minimap?
PLAYER_OUTLINE_COLOR = Color.new(255, 0, 0, 192) # Player Outline color
USE_OUTLINE_EVENT = true # Draw outline around events in minimap?
EVENT_OUTLINE_COLOR = Color.new(0, 0, 0, 0) # Player Outline color
PLAYER_COLOR = Color.new(255, 0, 0, 192) # Player color
#---------------------------------------------------------------------------
OBJECT_COLOR = {} # Don't change or delete this line!
#===============================================================
# * SETUP EVENT KEYWORD & COLOR
#---------------------------------------------------------------
# ** Template:
# OBJECT_COLOR['keyword'] = Color.new(Red, Green, Blue, Opacity)
#-------------------------------------------------------------
# * 'keyword': Word you want to put in event's comment to show this color
# ** Note: 'keyword' is CASE SENSITIVE!
# * Color.new(...): Color you want
# You can put between 0 - 255 in each argument (Red, Green, Blue, Opacity)
#-------------------------------------------------------------
OBJECT_COLOR['npc'] = Color.new(30,144,255,160)
OBJECT_COLOR['treasure'] = Color.new(255,255,0,160)
OBJECT_COLOR['enemy'] = Color.new(139,35,35,160)
OBJECT_COLOR['merchant'] = Color.new(0,255,0,80)
OBJECT_COLOR['sp'] =Color.new(255,255,255,125)
#===========================================================================
# * [OPTIONAL] TAGS:
#---------------------------------------------------------------------------
# Change keyword for disable minimap & keyword for show event on minimap~
#-----------------------------------------------------------------------
TAG_NO_MINIMAP = '[NOMAP]' # Tag for disable minimap
TAG_EVENT = 'MMEV' # Tag for show event on minimap
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
# [END] MINIMAP SCRIPT SETUP PART
#===========================================================================
def self.refresh
if $scene.is_a?(Scene_Map)
$scene.spriteset.minimap.refresh
end
end
def self.update_object
if $scene.is_a?(Scene_Map)
$scene.spriteset.minimap.update_object_list
end
end
end
#==============================================================================
# ■ RPG::MapInfo
#==============================================================================
class RPG::MapInfo
def name
return @name.gsub(/\[.*\]/) { }
end
def original_name
return @name
end
def show_minimap?
return !@name.include?(MiniMap::TAG_NO_MINIMAP)
end
end
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
attr_accessor :minimap
alias wora_minimap_gamsys_ini initialize
def initialize
wora_minimap_gamsys_ini
@minimap = MiniMap::MAP_RECT
end
def show_minimap
return !$game_switches[MiniMap::SWITCH_NO_MINIMAP]
end
end
#==============================================================================
# ■ Game_Map
#==============================================================================
class Game_Map
alias wora_minimap_gammap_setup setup
def setup(map_id)
wora_minimap_gammap_setup(map_id)
@db_info = load_data('Data/MapInfos.rvdata') if @db_info.nil?
@map_info = @db_info[map_id]
end
def show_minimap?
return @map_info.show_minimap?
end
end
#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event < Game_Character
def mm_comment?(comment, return_comment = false )
if !@list.nil?
for i in 0...@list.size - 1
next if @list[i].code != 108
if @list[i].parameters[0].include?(comment)
return @list[i].parameters[0] if return_comment
return true
end
end
end
return '' if return_comment
return false
end
end
#==============================================================================
# ■ Game_MiniMap
#------------------------------------------------------------------------------
class Game_MiniMap
def initialize(tilemap)
@tilemap = tilemap
refresh
end
def dispose
@border.bitmap.dispose
@border.dispose
@map_sprite.bitmap.dispose
@map_sprite.dispose
@object_sprite.bitmap.dispose
@object_sprite.dispose
@position_sprite.bitmap.dispose
@position_sprite.dispose
end
def visible
return @map_sprite.visible
end
def visible=(value)
@map_sprite.visible = value
@object_sprite.visible = value
@position_sprite.visible = value
@border.visible = value
end
def refresh
@mmr = $game_system.minimap
map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
grid_size = [MiniMap::GRID_SIZE, 1].max
@x = 0
@y = 0
@size = [map_rect.width / grid_size, map_rect.height / grid_size]
@border = Sprite.new
@border.x = map_rect.x - MiniMap::MINIMAP_BORDER_SIZE
@border.y = map_rect.y - MiniMap::MINIMAP_BORDER_SIZE
b_width = map_rect.width + (MiniMap::MINIMAP_BORDER_SIZE * 2)
b_height = map_rect.height + (MiniMap::MINIMAP_BORDER_SIZE * 2)
@border.bitmap = Bitmap.new(b_width, b_height)
@border.bitmap.fill_rect(@border.bitmap.rect, MiniMap::MINIMAP_BORDER_COLOR)
@border.bitmap.clear_rect(MiniMap::MINIMAP_BORDER_SIZE, MiniMap::MINIMAP_BORDER_SIZE,
@border.bitmap.width - (MiniMap::MINIMAP_BORDER_SIZE * 2),
@border.bitmap.height - (MiniMap::MINIMAP_BORDER_SIZE * 2))
@map_sprite = Sprite.new
@map_sprite.x = map_rect.x
@map_sprite.y = map_rect.y
@map_sprite.z = MiniMap::MAP_Z
bitmap_width = $game_map.width * grid_size + map_rect.width
bitmap_height = $game_map.height * grid_size + map_rect.height
@map_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
@map_sprite.src_rect = map_rect
@object_sprite = Sprite.new
@object_sprite.x = map_rect.x
@object_sprite.y = map_rect.y
@object_sprite.z = MiniMap::MAP_Z + 1
@object_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
@object_sprite.src_rect = map_rect
@position_sprite = Sprite_Base.new
@position_sprite.x = map_rect.x + @size[0] / 2 * grid_size
@position_sprite.y = map_rect.y + @size[1] / 2 * grid_size
@position_sprite.z = MiniMap::MAP_Z + 2
bitmap = Bitmap.new(grid_size, grid_size)
# Player's Outline
if MiniMap::USE_OUTLINE_PLAYER and MiniMap::GRID_SIZE >= 3
bitmap.fill_rect(bitmap.rect, MiniMap::PLAYER_OUTLINE_COLOR)
brect = Rect.new(bitmap.rect.x + 1, bitmap.rect.y + 1, bitmap.rect.width - 2,
bitmap.rect.height - 2)
bitmap.clear_rect(brect)
else
brect = bitmap.rect
end
bitmap.fill_rect(brect, MiniMap::PLAYER_COLOR)
@position_sprite.bitmap = bitmap
draw_map
update_object_list
draw_object
update_position
end
def draw_map
bitmap = @map_sprite.bitmap
bitmap.fill_rect(bitmap.rect, MiniMap::BACKGROUND_COLOR)
map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
grid_size = [MiniMap::GRID_SIZE, 1].max
$game_map.width.times do |i|
$game_map.height.times do |j|
if !$game_map.passable?(i, j)
next
end
rect = Rect.new(map_rect.width / 2 + grid_size * i,
map_rect.height / 2 + grid_size * j,
grid_size, grid_size)
if grid_size >= 3
if !$game_map.passable?(i, j)
rect.height -= 1
rect.x += 1
rect.width -= 1
rect.width -= 1
rect.y += 1
rect.height -= 1
end
end
bitmap.fill_rect(rect, MiniMap::FOREGROUND_COLOR)
end
end
end
def update_object_list
@object_list = {}
$game_map.events.values.each do |e|
comment = e.mm_comment?(MiniMap::TAG_EVENT, true)
if comment != ''
type = comment.gsub(/#{MiniMap::TAG_EVENT}/){}.gsub(/\s+/){}
@object_list[type] = [] if @object_list[type].nil?
@object_list[type] << e
end
end
end
def draw_object
bitmap = @object_sprite.bitmap
bitmap.clear
map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
grid_size = [MiniMap::GRID_SIZE, 1].max
rect = Rect.new(0, 0, grid_size, grid_size)
mw = map_rect.width / 2
mh = map_rect.height / 2
@object_list.each do |key, events|
color = MiniMap::OBJECT_COLOR[key]
next if events.nil? or color.nil?
events.each do |obj|
if !obj.character_name.empty?
rect.x = mw + obj.real_x * grid_size / 256
rect.y = mh + obj.real_y * grid_size / 256
# Event's Outline
if MiniMap::USE_OUTLINE_EVENT and MiniMap::GRID_SIZE >= 3
bitmap.fill_rect(rect, MiniMap::EVENT_OUTLINE_COLOR)
brect = Rect.new(rect.x + 1, rect.y + 1, rect.width - 2,
rect.height - 2)
bitmap.clear_rect(brect)
else
brect = bitmap.rect
end
bitmap.fill_rect(brect, color)
end
end
end
end
def update
if @mmr != $game_system.minimap
dispose
refresh
end
draw_object
update_position
if @map_sprite.visible
@map_sprite.update
@object_sprite.update
@position_sprite.update
end
end
def update_position
map_rect = Rect.new(@mmr[0], @mmr[1], @mmr[2], @mmr[3])
grid_size = [MiniMap::GRID_SIZE, 1].max
sx = $game_player.real_x * grid_size / 256
sy = $game_player.real_y * grid_size / 256
@map_sprite.src_rect.x = sx
@map_sprite.src_rect.y = sy
@object_sprite.src_rect.x = sx
@object_sprite.src_rect.y = sy
end
end
#==============================================================================
# ■ Spriteset_Map
#------------------------------------------------------------------------------
class Spriteset_Map
attr_reader :minimap
alias wora_minimap_sprsetmap_ini initialize
alias wora_minimap_sprsetmap_dis dispose
alias wora_minimap_sprsetmap_upd update
def initialize
wora_minimap_sprsetmap_ini
if $game_map.show_minimap?
@minimap = Game_MiniMap.new(@tilemap)
$game_system.show_minimap = true if $game_system.show_minimap.nil?
@minimap.visible = $game_system.show_minimap
end
end
def dispose
@minimap.dispose if !@minimap.nil?
wora_minimap_sprsetmap_dis
end
def update
if !@minimap.nil?
if $game_system.show_minimap
@minimap.visible = true
@minimap.update
else
@minimap.visible = false
end
end
wora_minimap_sprsetmap_upd
end
end
#==============================================================================
# ■ Scene_Map
#------------------------------------------------------------------------------
class Scene_Map < Scene_Base
attr_reader :spriteset
end |
Последнее редактирование: 13 года 8 мес. назад от jenovapr.
Администратор запретил публиковать записи гостям.
|
minimap vx 13 года 8 мес. назад #43260
|
Попробуй другой скрипт:
ВНИМАНИЕ: Спойлер! [ Нажмите, чтобы развернуть ][ Нажмите, чтобы скрыть ] #_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#_/ ◆ MiniMap - KGC_MiniMap ◆ VX ◆
#_/ ◇ Last Update: 2008/09/08 ◇
#_/ ◆ Translation by Mr. Anonymous ◆
#_/ ◆ KGC Site: ◆
#_/ ◆ http://f44.aaa.livedoor.jp/~ytomy/ ◆
#_/ ◆ Translator's Blog: ◆
#_/ ◆ http://mraprojects.wordpress.com ◆
#_/----------------------------------------------------------------------------
#_/ This script creates a "minimap" of the current area and displays it on the
#_/ screen. Note that you may disable the MiniMap on a given map by tagging the
#_/ map's name with [NOMAP].
#_/============================================================================
#_/ Install: Insert above KGC_SetAttackElement, if applicable.
#_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#==============================================================================#
# ★ Customization ★ #
#==============================================================================#
module KGC
module MiniMap
# ◆ MiniMap Switch ◆
# Here you may assign an in-game switch number to activate/deactivate the map.
MINIMAP_SWITCH_ID = 1
# ◆ MiniMap Display Properties ◆
# Here you may specify the X and Y coordinates as well as the width and height
# of the MiniMap.
# Format: X Coordinate Y Coordinate Width Height
MAP_RECT = Rect.new( 364, 20, 160, 120)
# ◆ Map Z Coordinate ◆
# Here you my specify the map's Z coordinate (depth).
MAP_Z = 0
# ◆ MiniMap Block Grid Size ◆
# Here you may specify the grid size of the minimap. 3 or more is recommended.
GRID_SIZE = 5
# ◆ MiniMap Foreground Color (Passable Space) ◆
# Format: Red, Green, Blue, Grey
FOREGROUND_COLOR = Color.new( 224, 224, 255, 160)
# ◆ MiniMap Background Color (Not Passable) ◆
# Format: Red, Green, Blue, Grey
BACKGROUND_COLOR = Color.new( 0, 0, 160, 160)
# ◆ Current Position Marker Color ◆
# Format: Red, Green, Blue, Grey
POSITION_COLOR = Color.new( 255, 0, 0, 192)
# ◆ Destination Event Marker Color ◆
# To start this effect, the event must have [MOVE] in its name.
# Format: Red, Green, Blue, Grey
MOVE_EVENT_COLOR = Color.new( 255, 160, 0, 192)
# ◆ Custom Objects Colors ◆
# Here you may specify different colors for different types of object markers.
# For example, you may have NPCs labeled [OBJ 1] in the event's name, while
# monsters labeled at [OBJ 2] and so forth.
# Please note that it's possible to add more, after OBJ 3. Just stick with
# the format: Color.new(0, 0, 0, 192), # [OBJ 4]
OBJECT_COLOR = [
# Format: Red, Green, Blue, Grey
Color.new( 0, 160, 0, 192), # [OBJ 1]
Color.new( 0, 160, 160, 192), # [OBJ 2]
Color.new(160, 0, 160, 192), # [OBJ 3]
# Insert additional objects here.
] # <- Do not remove!
# ◆ Position Marker Blinking Strength ◆
# Here you may specify how frequently the positional market blinks.
# A range of 5 to 8 is recommended.
BLINK_LEVEL = 7
end
end
#=============================================================================#
# ★ End Customization ★ #
#=============================================================================#
#=================================================#
# IMPORT #
#=================================================#
$imported = {} if $imported == nil
$imported["MiniMap"] = true
if $data_mapinfos == nil
$data_mapinfos = load_data("Data/MapInfos.rvdata")
end
#=================================================#
#==============================================================================
# □ KGC::MiniMap::Regexp
#==============================================================================
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Name Box Tag Strings #
# * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #
# Whatever word(s) are after the separator ( | ) in the following lines are
# what are used to determine what is searched for in the name box of an event.
module KGC::MiniMap
module Regexp
# ミニマップ非表示
NO_MINIMAP = /\[NOMAP\]/i
# 移動イベント
MOVE_EVENT = /\[MOVE\]/i
# オブジェクト
OBJECT = /\[OBJ(?:ECT)?\s*(\d)\]/i
end
module_function
#--------------------------------------------------------------------------
# ○ ミニマップ全体をリフレッシュ
#--------------------------------------------------------------------------
def refresh
return unless $scene.is_a?(Scene_Map)
$scene.refresh_minimap
end
#--------------------------------------------------------------------------
# ○ ミニマップのオブジェクトを更新
#--------------------------------------------------------------------------
def update_object
return unless $scene.is_a?(Scene_Map)
$scene.update_minimap_object
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ KGC::Commands
#==============================================================================
module KGC
module Commands
module_function
#--------------------------------------------------------------------------
# ○ Show the MiniMap
#--------------------------------------------------------------------------
def show_minimap
$game_system.minimap_show = true
end
#--------------------------------------------------------------------------
# ○ Hide the MiniMap
#--------------------------------------------------------------------------
def hide_minimap
$game_system.minimap_show = false
end
end
end
#=================================================#
# INCLUDE COMMANDS #
#=================================================#
# Include KGC::Commands in Game_Interpreter #
#=================================================#
class Game_Interpreter
include KGC::Commands
end
#=================================================#
#==============================================================================
# ■ RPG::MapInfo
#==============================================================================
class RPG::MapInfo
#--------------------------------------------------------------------------
# ● マップ名取得
#--------------------------------------------------------------------------
def name
return @name.gsub(/\[.*\]/) { "" }
end
#--------------------------------------------------------------------------
# ○ オリジナルマップ名取得
#--------------------------------------------------------------------------
def original_name
return @name
end
#--------------------------------------------------------------------------
# ○ ミニマップのキャッシュ生成
#--------------------------------------------------------------------------
def create_minimap_cache
@__minimap_show = !(@name =~ KGC::MiniMap::Regexp::NO_MINIMAP)
end
#--------------------------------------------------------------------------
# ○ ミニマップ表示
#--------------------------------------------------------------------------
def minimap_show?
create_minimap_cache if @__minimap_show == nil
return @__minimap_show
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_System
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# ○ ミニマップ表示フラグ取得
#--------------------------------------------------------------------------
def minimap_show
return $game_switches[KGC::MiniMap::MINIMAP_SWITCH_ID]
end
#--------------------------------------------------------------------------
# ○ ミニマップ表示フラグ変更
#--------------------------------------------------------------------------
def minimap_show=(value)
$game_switches[KGC::MiniMap::MINIMAP_SWITCH_ID] = value
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Map
#==============================================================================
class Game_Map
#--------------------------------------------------------------------------
# ○ ミニマップを表示するか
#--------------------------------------------------------------------------
def minimap_show?
return $data_mapinfos[map_id].minimap_show?
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Game_Event
#==============================================================================
class Game_Event < Game_Character
#--------------------------------------------------------------------------
# ○ イベント名
#--------------------------------------------------------------------------
def name
return @event.name
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ Game_MiniMap
#------------------------------------------------------------------------------
# ミニマップを扱うクラスです。
#==============================================================================
class Game_MiniMap
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize(tilemap)
@map_rect = KGC::MiniMap::MAP_RECT
@grid_size = [KGC::MiniMap::GRID_SIZE, 1].max
@x = 0
@y = 0
@size = [@map_rect.width / @grid_size, @map_rect.height / @grid_size]
@tilemap = tilemap
create_sprites
refresh
end
#--------------------------------------------------------------------------
# ○ スプライト作成
#--------------------------------------------------------------------------
def create_sprites
# マップ用スプライト作成
@map_sprite = Sprite.new
@map_sprite.x = @map_rect.x
@map_sprite.y = @map_rect.y
@map_sprite.z = KGC::MiniMap::MAP_Z
bitmap_width = $game_map.width * @grid_size + @map_rect.width
bitmap_height = $game_map.height * @grid_size + @map_rect.height
@map_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
@map_sprite.src_rect = @map_rect
# オブジェクト用スプライト作成
@object_sprite = Sprite_MiniMapIcon.new
@object_sprite.x = @map_rect.x
@object_sprite.y = @map_rect.y
@object_sprite.z = KGC::MiniMap::MAP_Z + 1
@object_sprite.bitmap = Bitmap.new(bitmap_width, bitmap_height)
@object_sprite.src_rect = @map_rect
# 現在位置スプライト作成
@position_sprite = Sprite_MiniMapIcon.new
@position_sprite.x = @map_rect.x + @size[0] / 2 * @grid_size
@position_sprite.y = @map_rect.y + @size[1] / 2 * @grid_size
@position_sprite.z = KGC::MiniMap::MAP_Z + 2
bitmap = Bitmap.new(@grid_size, @grid_size)
bitmap.fill_rect(bitmap.rect, KGC::MiniMap::POSITION_COLOR)
@position_sprite.bitmap = bitmap
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
def dispose
@map_sprite.bitmap.dispose
@map_sprite.dispose
@object_sprite.bitmap.dispose
@object_sprite.dispose
@position_sprite.bitmap.dispose
@position_sprite.dispose
end
#--------------------------------------------------------------------------
# ○ 可視状態取得
#--------------------------------------------------------------------------
def visible
return @map_sprite.visible
end
#--------------------------------------------------------------------------
# ○ 可視状態設定
#--------------------------------------------------------------------------
def visible=(value)
@map_sprite.visible = value
@object_sprite.visible = value
@position_sprite.visible = value
end
#--------------------------------------------------------------------------
# ○ リフレッシュ
#--------------------------------------------------------------------------
def refresh
draw_map
update_object_list
draw_object
update_position
end
#--------------------------------------------------------------------------
# ○ マップ描画
#--------------------------------------------------------------------------
def draw_map
bitmap = @map_sprite.bitmap
bitmap.fill_rect(bitmap.rect, KGC::MiniMap::BACKGROUND_COLOR)
rect = Rect.new(0, 0, @grid_size, @grid_size)
move_events = $game_map.events.values.find_all { |e|
e.name =~ KGC::MiniMap::Regexp::MOVE_EVENT
}
$game_map.width.times { |i| # X座標
$game_map.height.times { |j| # Y座標
next unless $game_map.passable?(i, j)
rect.x = @map_rect.width / 2 + @grid_size * i
rect.y = @map_rect.height / 2 + @grid_size * j
color = KGC::MiniMap::FOREGROUND_COLOR
move_events.each { |e|
if e.x == i && e.y == j
color = KGC::MiniMap::MOVE_EVENT_COLOR
break
end
}
bitmap.fill_rect(rect, color)
}
}
end
#--------------------------------------------------------------------------
# ○ オブジェクト一覧更新
#--------------------------------------------------------------------------
def update_object_list
@object_list = []
$game_map.events.values.each { |e|
if e.name =~ KGC::MiniMap::Regexp::OBJECT
type = $1.to_i
if @object_list[type] == nil
@object_list[type] = []
end
@object_list[type] << e
end
}
end
#--------------------------------------------------------------------------
# ○ オブジェクト描画
#--------------------------------------------------------------------------
def draw_object
# 下準備
bitmap = @object_sprite.bitmap
bitmap.clear
rect = Rect.new(0, 0, @grid_size, @grid_size)
mw = @map_rect.width / 2
mh = @map_rect.height / 2
# オブジェクト描画
@object_list.each_with_index { |list, i|
color = KGC::MiniMap::OBJECT_COLOR[i - 1]
next if list.nil? || color.nil?
list.each { |obj|
# グラフィックがある場合のみ表示
if obj.character_name != "" || obj.tile_id > 0
rect.x = mw + obj.real_x * @grid_size / 256
rect.y = mh + obj.real_y * @grid_size / 256
bitmap.fill_rect(rect, color)
end
}
}
end
#--------------------------------------------------------------------------
# ○ 更新
#--------------------------------------------------------------------------
def update
draw_object
update_position
if @map_sprite.visible
@map_sprite.update
@object_sprite.update
@position_sprite.update
end
end
#--------------------------------------------------------------------------
# ○ 位置更新
#--------------------------------------------------------------------------
def update_position
sx = $game_player.real_x * @grid_size / 256
sy = $game_player.real_y * @grid_size / 256
@map_sprite.src_rect.x = sx
@map_sprite.src_rect.y = sy
@object_sprite.src_rect.x = sx
@object_sprite.src_rect.y = sy
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# □ Sprite_MiniMapIcon
#------------------------------------------------------------------------------
# ミニマップ用アイコンのクラスです。
#==============================================================================
class Sprite_MiniMapIcon < Sprite
DURATION_MAX = 60
#--------------------------------------------------------------------------
# ● オブジェクト初期化
# viewport : ビューポート
#--------------------------------------------------------------------------
def initialize(viewport = nil)
super(viewport)
@duration = DURATION_MAX / 2
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
def update
super
@duration += 1
if @duration == DURATION_MAX
@duration = 0
end
update_effect
end
#--------------------------------------------------------------------------
# ○ エフェクトの更新
#--------------------------------------------------------------------------
def update_effect
self.color.set(255, 255, 255,
(@duration - DURATION_MAX / 2).abs * KGC::MiniMap::BLINK_LEVEL)
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Spriteset_Map
#==============================================================================
class Spriteset_Map
attr_reader :minimap
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias initialize_KGC_MiniMap initialize
def initialize
initialize_KGC_MiniMap
create_minimap
end
#--------------------------------------------------------------------------
# ○ ミニマップ作成
#--------------------------------------------------------------------------
def create_minimap
return unless $game_map.minimap_show?
@minimap = Game_MiniMap.new(@tilemap)
@minimap.visible = $game_system.minimap_show
end
#--------------------------------------------------------------------------
# ● 解放
#--------------------------------------------------------------------------
alias dispose_KGC_MiniMap dispose
def dispose
dispose_KGC_MiniMap
dispose_minimap
end
#--------------------------------------------------------------------------
# ○ ミニマップ解放
#--------------------------------------------------------------------------
def dispose_minimap
@minimap.dispose if @minimap != nil
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias update_KGC_MiniMap update
def update
update_KGC_MiniMap
update_minimap
end
#--------------------------------------------------------------------------
# ○ ミニマップ更新
#--------------------------------------------------------------------------
def update_minimap
return if @minimap == nil
if $game_system.minimap_show
@minimap.visible = true
@minimap.update
else
@minimap.visible = false
end
end
#--------------------------------------------------------------------------
# ○ ミニマップ全体をリフレッシュ
#--------------------------------------------------------------------------
def refresh_minimap
@minimap.refresh
end
#--------------------------------------------------------------------------
# ○ ミニマップのオブジェクトを更新
#--------------------------------------------------------------------------
def update_minimap_object
@minimap.update_object_list
end
end
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
#==============================================================================
# ■ Scene_Map
#==============================================================================
class Scene_Map
#--------------------------------------------------------------------------
# ○ ミニマップ全体をリフレッシュ
#--------------------------------------------------------------------------
def refresh_minimap
@spriteset.refresh_minimap
end
#--------------------------------------------------------------------------
# ○ ミニマップのオブジェクトを更新
#--------------------------------------------------------------------------
def update_minimap_object
@spriteset.update_minimap_object
end
end |
Администратор запретил публиковать записи гостям.
|
minimap vx 13 года 8 мес. назад #43298
|
Ваш скрипт, ничем не помог((( АПсалютно тоже самое
|
Администратор запретил публиковать записи гостям.
|
Время создания страницы: 0.246 секунд