查看: 895|回复: 0

[有事请教] [已解决]地图设置宽50高41如何显示聚焦在宽30高28的方格上

[复制链接]
梦石
0
星屑
7296
在线时间
1244 小时
注册时间
2015-8-15
回帖
473
发表于 2024-7-8 09:21:10 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 金芒芒 于 2024-7-8 12:47 编辑

如图[已解决]
进入没有主角的地图 聚焦到地图x960 y898  或宽方格30高方格28上
[pre lang="ruby"]#==============================================================================
# ■ 华丽镜头移动脚本  by 黑暗之神Kaiser.DS
#------------------------------------------------------------------------------
#  1-插入此段脚本到Main前面
#   2-功能
#     a-[镜头平滑移动到事件/角色]
#       在事件里的[设置移动路线]里选择需要镜头转向的角色输入脚本kds即可
#     b-[镜头跟随事件]
#       在事件里的[设置移动路线]选择好需要跟随的事件后输入脚本kds_move_start开
#       始跟随,当不想跟随时再输入kds_move_over
#==============================================================================
$平滑移动 = nil
class Scene_Map
  alias kds_update update
  def update
    kds_update
    if $平滑移动 != nil
      deal_pinghuayidong
    end
  end
  
  
  def deal_pinghuayidong  #定义处理_平滑移动
      cen_x = (600 - 16) * 4
      cen_y = (350 - 16) * 4
      max_x = ($game_map.width - 20) * 128
      max_y = ($game_map.height - 15) * 128
      display_x = [0, [$平滑移动.x * 128 - cen_x, max_x].min].max
      display_y = [0, [$平滑移动.y * 128 - 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)/8
         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)/8
         end
      end
      if $game_map.display_x == display_x  and $game_map.display_y == display_y
         $平滑移动.center($平滑移动.x, $平滑移动.y)
         $平滑移动 = nil
       end
      return
  end
  
  
end
class Game_Character
  CENTER_X = (600 - 16) * 4
  CENTER_Y = (350 - 16) * 4
  attr_accessor :old_display_x
  attr_accessor :old_display_y
  attr_accessor :kds_move
  def center(x, y)
    max_x = ($game_map.width - 20) * 128
    max_y = ($game_map.height - 15) * 128
    $game_map.display_x = [0, [x * 128 - CENTER_X, max_x].min].max
    $game_map.display_y = [0, [y * 128 - CENTER_Y, max_y].min].max
  end
  def kds
    @old_display_x = $game_map.display_x
    @old_display_y = $game_map.display_y
    # p 1
   
   
    if $game_temp.inefs #in efs
     
      if $scene.current_leader == nil
        $平滑移动 = $game_player
       # p 1
      else
        $平滑移动 = $scene.current_leader
      end
   
    elsif $game_temp.inslg # In srpg
      
      $平滑移动 = self
    else # Normal
      
      $平滑移动 = self
    end  
   
   
   $scene.deal_pinghuayidong
   
  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
[/pre]
路线镜头.png
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部