#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
#NPC视野
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● 像通到画面中央一样的设置地图的显示位置
#--------------------------------------------------------------------------
def centerNPC(id)
if id==0
$目标视角=$game_player #可以使角色在粘在车子上
max_x = ($game_map.width - 20) * 128
max_y = ($game_map.height - 15) * 128
$game_map.display_x = [0, [$game_player.real_x - CENTER_X, max_x].min].max #-1000 #加括号, 超出地图的坐标,同樣有效
$game_map.display_y = [0, [$game_player.real_y - CENTER_Y, max_y].min].max #-1000
else
#$目标视角=$game_map.events[id]#可以使角色在粘在车子上 ,需单独使用(下面的就不需要)
#max_x = ($game_map.width - 20) * 128
#max_y = ($game_map.height - 15) * 128
#$game_map.display_x = [0, [$game_map.events[id].real_x - CENTER_X, max_x].min].max
#$game_map.display_y = [0, [$game_map.events[id].real_y - CENTER_Y, max_y].min].max
#,#{a},#{a},
=begin ##粘車測試
delay = 2 if delay == nil
if delay < 2
delay+1
return false
end
if delay == 2
#return true
delay = 0
end
=end
#x_sub = $game_player.real_x - $game_map.events[id].real_x
#y_sub = $game_player.real_y - $game_map.events[id].real_y
#=begin
x_sub = ($game_map.display_x+128*8.5) - $game_map.events[id].real_x
y_sub = ($game_map.display_y+128*7) - $game_map.events[id].real_y
#pst"#{($game_map.display_x+128*8.5)},#{$game_map.events[id].real_x}"
#x_sub-500減多少都无用
#y_sub-500
x_a = x_sub.abs #求绝对值相减(位移)
y_a = y_sub.abs
if x_sub == 0 and y_sub == 0
end
sped = 10 #画面的移动速度
sped_x = ([x_a*0.2,60].min).to_i
#画面x的最大移动速度, 用x_a*0.2和60 两个值比较,取较小的值
sped_y = ([y_a*0.2,60].min).to_i
sped_x = 1 if x_a <sped #若画面的移动速度小于该速度最大值就变1, 不然一直画面跳动
sped_y = 1 if y_a <sped
if x_sub > 0 #目标事件在左边, 画面x轴向左移动
$game_map.display_x-=sped_x#(x_sub.abs)
#$game_map.scroll_left(x_sub.abs/128)
else x_sub < 0 #目标事件在右边, 画面x轴向右移动
# p 1
$game_map.display_x+=sped_x#(x_sub.abs)
#$game_map.scroll_right(x_sub.abs/128)
end
if y_sub>0 #目标事件在上边, 画面y轴向上移动
$game_map.display_y-=sped_y#(y_sub.abs)
#$game_map.scroll_up(y_sub.abs/128)
else y_sub < 0 #目标事件在下边, 画面y轴向下移动
#$game_map.scroll_down(y_sub.abs/128)
$game_map.display_y+=sped_y#(y_sub.abs)
end
#=end ##粘車測試 #可能不是漸移,不知
end
end
end
#==============================================================================
# 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
#==============================================================================
=begin
__END__#没做延时移备份
x_sub = ($game_map.display_x+128*8.5) - $game_map.events[id].real_x
y_sub = ($game_map.display_y+128*7) - $game_map.events[id].real_y
pst"#{($game_map.display_x+128*8.5)},#{$game_map.events[id].real_x}"
#x_sub-500減多少都无用
#y_sub-500
x = x_sub.abs
y = y_sub.abs
if x_sub = 0 and y_sub = 0
break
end
if x_sub> 0 #在右边
for i in 0...x
$game_map.display_x-=1#(x_sub.abs)
#$game_map.scroll_left(x_sub.abs/128)
end
else x_sub < 0
for i in 0...x
$game_map.display_x+=1#(x_sub.abs)
#$game_map.scroll_right(x_sub.abs/128)
end
end
if y_sub>0 #在下边
for i in 0...y
$game_map.display_y-=1#(y_sub.abs)
#$game_map.scroll_up(y_sub.abs/128)
end
else y_sub < 0
for i in 0...y
#$game_map.scroll_down(y_sub.abs/128)
$game_map.display_y+=1#(y_sub.abs)
end
=end