#--------------------------------------------------------------------------
# ● 计算 X 座标减去显示座标
# x : X 座标
#--------------------------------------------------------------------------
def adjust_x(x)
return x - @display_x
end
#--------------------------------------------------------------------------
# ● 计算 Y 座标减去显示座标
# y : Y 座标
#--------------------------------------------------------------------------
def adjust_y(y)
return y - @display_y
end
end
以上是脚本,希望哪位朋友可以帮我解决下。上面的判断我没用,好象也用不起,想增加一个开关控制,可行否。作者: 张咚咚 时间: 2013-1-13 13:10
#==============================================================================
# ■ 弹性滚动地图 V 1.00 BY SLICK
#------------------------------------------------------------------------------
# 处理主角的类。事件启动的判定、以及地图的滚动等功能。
# 本类的实例请参考 $game_player。
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ● 处理滚动
#--------------------------------------------------------------------------
def update_scroll(last_real_x, last_real_y)
if $game_switches[1] == true # 当1号开关打开,弹性滚动地图就关闭
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)
if ay2 > ay1 and ay2 > CENTER_Y
$game_map.scroll_down(ay2 - ay1)
end
if ax2 < ax1 and ax2 < CENTER_X
$game_map.scroll_left(ax1 - ax2)
end
if ax2 > ax1 and ax2 > CENTER_X
$game_map.scroll_right(ax2 - ax1)
end
if ay2 < ay1 and ay2 < CENTER_Y
$game_map.scroll_up(ay1 - ay2)
end
else
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)
slowmove = (2 ** (@move_speed - 1)).to_i
fastmove = $game_variables[7]+(2 ** @move_speed).to_i
length = (2 ** (@move_speed + 4)).to_i
if ax2 < CENTER_X - 8
if (ax2 - CENTER_X) <= -length
$game_map.scroll_left(fastmove)
else
$game_map.scroll_left(slowmove)
end
elsif ax2 > CENTER_X + 8
if (ax2 - CENTER_X) >= length
$game_map.scroll_right(fastmove)
else
$game_map.scroll_right(slowmove)
end
end
if ay2 < CENTER_Y - 8
if (ay2 - CENTER_Y) <= -length
$game_map.scroll_up(fastmove)
else
$game_map.scroll_up(slowmove)
end
elsif ay2 > CENTER_Y + 8
if (ay2 - CENTER_Y) >= length
$game_map.scroll_down(fastmove)
else
$game_map.scroll_down(slowmove)
end
end
end
end
end作者: ctvip 时间: 2013-1-13 13:23
暂时还没发现什么大问题,呵呵