ALLMAP = 1 #记录已开启地图的变量的ID。
FR = 20 #聚焦半径,当交叉点的坐标离地图目标距离在20个像素以内时,会自动移动靠近。
module SATEMAP
#定义目标地图,举例:
#TAGMAP[1] = [400,139,14,4,8]
#1表示地图ID,400和139表示点在大地图上的坐标,14和4表示场所移动后的坐标。8是朝向。
#也就是说,当横轴与纵轴的交叉点坐标为400,139时,玩家按下确定键,角色就会面朝上移动到
#1号地图坐标为14,4的地点。
TAGMAP = []
TAGMAP[0] = [0,0,0,0,0,0]
TAGMAP[1] = [0,0,0,0,0,0]
TAGMAP[2] = [97,149,1,7,6,2]#森林,面朝右
TAGMAP[3] = [319,270,1,22,6,3]#山村,面朝右
TAGMAP[4] = [209,97,5,28,8,4]#沉默,面朝上
TAGMAP[5] = [565,328,10,1,2,5]#悬崖,面朝下
TAGMAP[6] = [505,84,1,9,6,6]#极北,面朝右
TAGMAP[7] = [395,136,1,9,6,7]#体内,面朝右
TAGMAP[8] = [477,206,20,30,8,8]#海港,面朝上
TAGMAP[9] = [453,341,11,32,8,9]#深渊,面朝上
end
#==============================================================================
# ■ Scene_Satellite
#------------------------------------------------------------------------------
# 处理卫星地图画面
#==============================================================================
class Scene_Satellite
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
@allmap_id = $game_variables[ALLMAP]
@focus = 0
@map_id = $game_map.map_id
[url=home.php?mod=space&uid=36110]@Wait[/url] = 0
@scroll_time = 8
@m_real = [nil,nil]
@m_target = [nil,nil]
@m_gap = [nil,nil]
@tgm = SATEMAP::TAGMAP.dup
while @tgm[0][5] == 0
@tgm.shift
end
@index = @tgm.index(SATEMAP::TAGMAP[@map_id])
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 创建背景
@back = Sprite.new
@back.bitmap = Bitmap.new("Graphics/Systems/back")
# 创建X轴
@mm_x = Sprite.new
@mm_x.bitmap = Bitmap.new("Graphics/Systems/mm_x")
@mm_x.y = SATEMAP::TAGMAP[@map_id][1]
# 创建Y轴
@mm_y = Sprite.new
@mm_y.bitmap = Bitmap.new("Graphics/Systems/mm_y")
@mm_y.x = SATEMAP::TAGMAP[@map_id][0]
# 创建地点缩略图
@mm_icon = Sprite.new
@mm_icon.bitmap = Bitmap.new("Graphics/Systems/Icon/"+@map_id.to_s)
@mm_icon.x = 15
@mm_icon.y = 232
# 创建地名
@mm_name = Sprite.new
@mm_name.bitmap = Bitmap.new("Graphics/Systems/Name/"+@map_id.to_s)
@mm_name.x = 60
@mm_name.y = 380
# 执行过度
Graphics.transition(30, "Graphics/Transitions/019-Whorl01" )
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换就中断循环
if $scene != self
break
end
end
# 装备过渡
Graphics.freeze
# 释放窗口
@back.dispose
@mm_x.dispose
@mm_y.dispose
@mm_name.dispose
@mm_icon.dispose
end
def auto_scroll
for i in 0..1
@m_real[i] = (@wait > 1)?(@m_target[i] - @m_gap[i] * (@wait ** 2) / (@scroll_time ** 2)):@m_target[i]
end
@mm_y.x,@mm_x.y = @m_real[0],@m_real[1]
@wait -= 1
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
if @wait > 0
auto_scroll
return
end
if @map_id != @tgm[@index][5]
@map_id = @tgm[@index][5]
@mm_icon.bitmap = Bitmap.new("Graphics/Systems/Icon/"+@map_id.to_s)
@mm_name.bitmap = Bitmap.new("Graphics/Systems/Name/"+@map_id.to_s)
end
# disjudge
# 按下 X 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
#========================================================
if Input.press?(Input::LEFT)
old = @tgm[@index]
@tgm.sort!{|a,b| a[0] - b[0]}
@index = @tgm.index(old)
@wait = @scroll_time
@m_real[0],@m_real[1] = @tgm[@index][0],@tgm[@index][1]
if @index == 0
x,y = @tgm[@tgm.size - 1][0],@tgm[@tgm.size - 1][1]
@index = @tgm.size - 1
else
x,y = @tgm[@index - 1][0],@tgm[@index - 1][1]
@index = @index - 1
end
@m_target = [x,y]
for i in 0..1
@m_gap[i] = @m_target[i] - @m_real[i]
end
end
#========================================================
if Input.press?(Input::RIGHT)
old = @tgm[@index]
@tgm.sort!{|a,b| a[0] - b[0]}
@index = @tgm.index(old)
@wait = @scroll_time
@m_real[0],@m_real[1] = @tgm[@index][0],@tgm[@index][1]
if @index == @tgm.size - 1
x,y = @tgm[0][0],@tgm[0][1]
@index = 0
else
x,y = @tgm[@index + 1][0],@tgm[@index + 1][1]
@index = @index + 1
end
@m_target = [x,y]
for i in 0..1
@m_gap[i] = @m_target[i] - @m_real[i]
end
end
#========================================================
#========================================================
if Input.press?(Input::UP)
old = @tgm[@index]
@tgm.sort!{|a,b| a[1] - b[1]}
@index = @tgm.index(old)
@wait = @scroll_time
@m_real[0],@m_real[1] = @tgm[@index][0],@tgm[@index][1]
if @index == 0
x,y = @tgm[@tgm.size - 1][0],@tgm[@tgm.size - 1][1]
@index = @tgm.size - 1
else
x,y = @tgm[@index - 1][0],@tgm[@index - 1][1]
@index = @index - 1
end
@m_target = [x,y]
for i in 0..1
@m_gap[i] = @m_target[i] - @m_real[i]
end
end
#========================================================
if Input.press?(Input::DOWN)
old = @tgm[@index]
@tgm.sort!{|a,b| a[1] - b[1]}
@index = @tgm.index(old)
@wait = @scroll_time
@m_real[0],@m_real[1] = @tgm[@index][0],@tgm[@index][1]
if @index == @tgm.size - 1
x,y = @tgm[0][0],@tgm[0][1]
@index = 0
else
x,y = @tgm[@index + 1][0],@tgm[@index + 1][1]
@index = @index + 1
end
@m_target = [x,y]
for i in 0..1
@m_gap[i] = @m_target[i] - @m_real[i]
end
end
#========================================================
if Input.trigger?(Input::C)
# if @tag_lock
$game_system.se_play($data_system.decision_se)
$game_screen.start_tone_change(Tone.new(-255,-255,-255,0), 0)
$scene = Scene_Map.new
$game_temp.player_transferring = true
$game_temp.player_new_map_id = @map_id
$game_temp.player_new_x=SATEMAP::TAGMAP[@map_id][2]
$game_temp.player_new_y=SATEMAP::TAGMAP[@map_id][3]
$game_temp.player_new_direction = SATEMAP::TAGMAP[@map_id][4]
$game_screen.start_tone_change(Tone.new(0,0,0,0), 10)
end
end
end