#==============================================================================
# ■ 弹性滚动地图 V 1.00 BY SLICK
#------------------------------------------------------------------------------
# 处理主角的类。事件启动的判定、以及地图的滚动等功能。
# 本类的实例请参考 $game_player。
#==============================================================================
class Game_Player < Game_Character
def update_scroll(last_real_x, last_real_y)
ax1 = $game_map.adjust_x(last_real_x)
ay1 = $game_map.adjust_y(last_real_y)
ax2 = $game_map.adjust_x(@real_x)
ay2 = $game_map.adjust_y(@real_y)
basicspd = 2 ** real_move_speed / 1024.0
slowmove = basicspd*2
fastmove = basicspd*3
if ax2 < center_x - 1
if ax2 < center_x - 3
$game_map.scroll_left(fastmove)
else
$game_map.scroll_left(slowmove)
end
elsif ax2 > center_x + 1
if ax2 > center_x + 3
$game_map.scroll_right(fastmove)
else
$game_map.scroll_right(slowmove)
end
end
if ay2 < center_y - 1
if ay2 < center_y - 3
$game_map.scroll_up(fastmove)
else
$game_map.scroll_up(slowmove)
end
elsif ay2 > center_y + 1
if ay2 > center_y + 3
$game_map.scroll_down(fastmove)
else
$game_map.scroll_down(slowmove)
end
end
end
end
#==============================================================================
# ■ 弹性滚动地图 V 1.00 BY SLICK
#------------------------------------------------------------------------------
# 处理主角的类。事件启动的判定、以及地图的滚动等功能。
# 本类的实例请参考 $game_player。
#==============================================================================
class Game_Player < Game_Character
def update_scroll(last_real_x, last_real_y)
ax1 = $game_map.adjust_x(last_real_x)
ay1 = $game_map.adjust_y(last_real_y)
ax2 = $game_map.adjust_x(@real_x)
ay2 = $game_map.adjust_y(@real_y)
basicspd = 2 ** real_move_speed / 1024.0
slowmove = basicspd*2
fastmove = basicspd*3
if ax2 < center_x - 1
if ax2 < center_x - 3
$game_map.scroll_left(fastmove)
else
$game_map.scroll_left(slowmove)
end
elsif ax2 > center_x + 1
if ax2 > center_x + 3
$game_map.scroll_right(fastmove)
else
$game_map.scroll_right(slowmove)
end
end
if ay2 < center_y - 1
if ay2 < center_y - 3
$game_map.scroll_up(fastmove)
else
$game_map.scroll_up(slowmove)
end
elsif ay2 > center_y + 1
if ay2 > center_y + 3
$game_map.scroll_down(fastmove)
else
$game_map.scroll_down(slowmove)
end
end
end
end
这东西可以实现美观的不卡的地图滚动
下面是一个黄金版,不过要花钱。
@fux2黄金版的写法貌似已经很好了...普通版主要是移植,基本没写什么代码