- 注册时间
- 2009-2-21
- 最后登录
- 2019-5-19
⑤进阶
- 积分
- 908
|
发表于 2009-2-27 11:17:37
|
显示全部楼层
作为你上次给我极限脚本的答谢送你一个 华丽的镜头脚本
# -功能
# a-[镜头平滑移动到事件/角色]
# 在事件里的[设置移动路线]里选择需要镜头转向的角色输入脚本kds即可
# b-[镜头跟随事件]
# 在事件里的[设置移动路线]选择好需要跟随的事件后输入脚本kds_move_start开
# 始跟随,当不想跟随时再输入kds_move_over
#==============================================================================
class Game_Map
attr_accessor :display_x # 显示 X 坐标 * 256
attr_accessor :display_y # 显示 Y 坐标 * 256
end
$平滑移动 = nil
class Scene_Map
alias kds_update update
def update
kds_update
if $平滑移动 != nil
cen_x = Game_Character::CENTER_X
cen_y = Game_Character::CENTER_Y
max_x = ($game_map.width - 17) * 256
max_y = ($game_map.height - 13) * 256
display_x = [0, [$平滑移动.x * 256 - cen_x, max_x].min].max
display_y = [0, [$平滑移动.y * 256 - cen_y, max_y].min].max
if $game_map.display_x != display_x
if ($game_map.display_x - display_x).abs < 22
$game_map.display_x = display_x
else
$game_map.display_x += (display_x - $平滑移动.old_display_x)/32
end
end
if $game_map.display_y != display_y
if ($game_map.display_y - display_y).abs <= 22
$game_map.display_y = display_y
else
$game_map.display_y += (display_y - $平滑移动.old_display_y)/32
end
end
if $game_map.display_x == display_x and $game_map.display_y == display_y
$平滑移动.center($平滑移动.x, $平滑移动.y)
$平滑移动 = nil
end
return
end
end
end
class Game_Character
CENTER_X = (544 / 2 - 16) * 8 # 画面中央的 X 坐标 * 8
CENTER_Y = (416 / 2 - 16) * 8 # 画面中央的 Y 坐标 * 8
attr_accessor ld_display_x
attr_accessor ld_display_y
attr_accessor :kds_move
def center(x, y)
max_x = ($game_map.width - 17) * 256
max_y = ($game_map.height - 13) * 256
$game_map.display_x = [0, [x * 256 - CENTER_X, max_x].min].max
$game_map.display_y = [0, [y * 256 - CENTER_Y, max_y].min].max
end
def kds
@old_display_x = $game_map.display_x
@old_display_y = $game_map.display_y
case @id
when 0
$平滑移动 = $game_player
else
$平滑移动 = $game_map.events[@id]
end
end
def kds_move_start
@kds_move = ""
end
def kds_move_over
@kds_move = nil
end
alias kds_update update
def update
last_real_x = @real_x
last_real_y = @real_y
kds_update
if @kds_move != nil
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
$game_map.scroll_down(@real_y - last_real_y)
end
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
$game_map.scroll_left(last_real_x - @real_x)
end
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
$game_map.scroll_right(@real_x - last_real_x)
end
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
$game_map.scroll_up(last_real_y - @real_y)
end
end
end
end
#==============================================================================
测试发现和多人脚本有一点点的冲突=。= 我的那个多人脚本 不过问题不大就是镜头回到主角身上不行 可以用 事件里的镜头移动回去 |
|