RPGXP Script
2013.09.24 07:25

촬영 기술(부드러운 맵스크롤)

Views 1843 Votes 0 Comment 2
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print
#==============================================================================
# ★ 촬영 기술 var 1.0 (07.2.12)  by shun 번역: 인간(jty1025)
#------------------------------------------------------------------------------
#   맵 화면에서 스크롤을 카메라풍으로 늦추거나
#   플레이어와는 독립시켜 스크롤 시키거나 할 수 있습니다.
#==============================================================================
module SIMP
  #--------------------------------------------------------------------------
  # ○ 설정
  #--------------------------------------------------------------------------
  #
  # 스크롤 속도
  #
  CAMERA_MIN_SPEED = 1            # 최저한의 스크롤 속도
  CAMERA_DELEY = 2                # 속도 보정 (값이 큰 만큼 늦는다)
  #
  # 독립 스크롤
  #
  CAMERA_SCROLL_SWITCH = 48       # 스크롤 금지 스위치의 번호
  CAMERA_SCROLL_KEY = Input::A    # 스크롤을 개시하는 버튼 (Input::<버튼>)
  CAMERA_SCROLL_SPEED = 5        # 스크롤 하는 기본 속도
  CAMERA_SCROLL_DIR8 = true       # 8 방향 입력
end
class Game_Map
  #--------------------------------------------------------------------------
  # ● 공개 인스턴스 변수
  #--------------------------------------------------------------------------
  attr_writer   :real_display_x           # X 좌표 (실좌표)
  attr_writer   :real_display_y           # Y 좌표 (실좌표)
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  alias camera_initialize initialize
  def initialize
    camera_initialize
    @real_display_x = 0
    @real_display_y = 0
  end
  #--------------------------------------------------------------------------
  # ● 셋업
  #     map_id : 맵 ID
  #--------------------------------------------------------------------------
  alias camera_setup setup
  def setup(map_id)
    camera_setup(map_id)
    @real_display_x = 0
    @real_display_y = 0
  end
  #--------------------------------------------------------------------------
  # ● 표시 X 좌표 * 128
  #--------------------------------------------------------------------------
  def display_x
    return @real_display_x
  end
  #--------------------------------------------------------------------------
  # ● 표시 Y 좌표 * 128
  #--------------------------------------------------------------------------
  def display_y
    return @real_display_y
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  alias camera_update update
  def update
    camera_update
    dx = @display_x - @real_display_x
    unless dx == 0
      speed = get_speed(dx.abs)
      distance = 2 ** speed
      if dx > 0
        @real_display_x = [@real_display_x + distance, @display_x].min
      else
        @real_display_x = [@real_display_x - distance, @display_x].max
      end
    end
    dy = @display_y - @real_display_y
    unless dy == 0
      speed = get_speed(dy.abs)
      distance = 2 ** speed
      if dy > 0
        @real_display_y = [@real_display_y + distance, @display_y].min
      else
        @real_display_y = [@real_display_y - distance, @display_y].max
      end
    end
  end
  #--------------------------------------------------------------------------
  # ○ 스크롤 속도를 취득
  #     distance : 움직이는 목표까지의 거리
  #--------------------------------------------------------------------------
  def get_speed(distance)
    return [SIMP::CAMERA_MIN_SPEED, distance / 32 - SIMP::CAMERA_DELEY].max
  end
end
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  alias camera_update update
  def update
    # 이동중, 이벤트 실행중, 이동 루트 강제중,
    # 메세지 윈도우 표시중의 머지않아도 아닌 경우
    unless moving? or $game_system.map_interpreter.running? or
           @move_route_forcing or $game_temp.message_window_showing
      # 스크롤 키가 밀렸을 경우, 독립 스크롤 플래그를 유효하게 한다
      if Input.trigger?(SIMP::CAMERA_SCROLL_KEY) and @scroll != true and
         $game_switches[SIMP::CAMERA_SCROLL_SWITCH] != true
        # 결정 SE 를 연주
        $game_system.se_play($data_system.decision_se)
        @scroll = true
        Input.update
      end
    end
    # 독립 스크롤중의 경우
    if @scroll
      super
      update_scroll
    else
      camera_update
    end
  end
  #--------------------------------------------------------------------------
  # ○ 프레임 갱신 (독립 스크롤)
  #--------------------------------------------------------------------------
  def update_scroll
    # 스크롤 키가 밀렸을 경우
    if Input.trigger?(SIMP::CAMERA_SCROLL_KEY)
      # 캔슬 SE 를 연주
      $game_system.se_play($data_system.cancel_se)
      # 플레이어에 화면을 되돌린다
      center(@x, @y)
      # 독립 스크롤 플래그를 무효로 한다
      @scroll = false
      return
    end
    distance = 2 ** SIMP::CAMERA_SCROLL_SPEED
    # 방향 버튼이 밀리고 있으면, 그 방향에 스크롤
    dir = (SIMP::CAMERA_SCROLL_DIR8 ? Input.dir8 : Input.dir4)
    case dir
    when 1
      $game_map.scroll_down(distance)
      $game_map.scroll_left(distance)
    when 2
      $game_map.scroll_down(distance)
    when 3
      $game_map.scroll_down(distance)
      $game_map.scroll_right(distance)
    when 4
      $game_map.scroll_left(distance)
    when 6
      $game_map.scroll_right(distance)
    when 7
      $game_map.scroll_left(distance)
      $game_map.scroll_up(distance)
    when 8
      $game_map.scroll_up(distance)
    when 9
      $game_map.scroll_right(distance)
      $game_map.scroll_up(distance)
    end
  end
  #--------------------------------------------------------------------------
  # ● 화면 중앙에 오도록(듯이) 맵의 표시 위치를 설정
  #--------------------------------------------------------------------------
  alias camera_center center
  def center(x, y)
    camera_center(x, y)
    $game_map.real_display_x = $game_map.display_x
    $game_map.real_display_y = $game_map.display_y
  end
end
  #--------------------------------------------------------------------------

출처: RKC
?

  1. Mog_Battle_hud(MZ버전도 있습니다)

    Date2021.03.05 CategoryRPGMV Plugin By스트레이보우 Views2013 Votes0
    Read More
  2. 컷신 플러그인

    Date2020.10.30 CategoryRPGMV Plugin By스트레이보우 Views2694 Votes0
    Read More
  3. 업적플러그인

    Date2020.09.02 CategoryRPGMV Plugin By스트레이보우 Views2269 Votes0
    Read More
  4. 한글조합입력기(영어가능)

    Date2019.11.10 CategoryRPGXP Script By조규진1 Views1206 Votes0
    Read More
  5. 게임에서 제공해주는 노래가 아닌 외부에서 다운받고 안에 넣어쓰려면 어떻게 해야하나요?

    Date2019.07.26 CategoryRPGMV Plugin ByBigOrca Views1652 Votes0
    Read More
  6. Ghost Effect

    Date2019.01.20 CategoryRPGMV Plugin By러닝은빛 Views1325 Votes0
    Read More
  7. RPG XP Xas액알

    Date2018.10.30 CategoryRPGXP Script By심심치 Views1334 Votes0
    Read More
  8. 커스텀 숫자 입력 패드

    Date2018.10.19 CategoryRPGMV Plugin By러닝은빛 Views1401 Votes0
    Read More
  9. 9마리 이상의 몬스터 설정 | More Enemies

    Date2018.08.31 CategoryRPGMV Plugin By러닝은빛 Views1152 Votes0
    Read More
  10. 동적 맵 타일 수정 플러그인

    Date2018.07.17 CategoryRPGMV Plugin By베지테리안카카오 Views1252 Votes0
    Read More
  11. VXA에서 XBOX360 컨트롤러 사용 여부 체크

    Date2018.07.15 CategoryRPGVX Ace script By러닝은빛 Views1054 Votes0
    Read More
  12. RMMV 옵션 창에 메시지 속도 및 글자 크기 변경 기능 추가

    Date2018.07.15 CategoryRPGMV Plugin By러닝은빛 Views1799 Votes0
    Read More
  13. 한글 데미지 표시

    Date2018.07.09 CategoryRPGMV Plugin By러닝은빛 Views1618 Votes0
    Read More
  14. [ MV ] 심장[체력표시 하트] 플러그인

    Date2018.07.01 CategoryRPGMV Plugin By수성의물 Views2409 Votes0
    Read More
  15. [鳥小屋] 실적 플러그인(인게임 트로피 시스템)

    Date2017.10.31 CategoryRPGMV Plugin By이니군 Views1910 Votes0
    Read More
  16. LuD Script Package

    Date2017.08.16 CategoryRPGVX Ace script ByLuD Views1825 Votes0
    Read More
  17. [VXAce] 레이어 맵 <layer> 시스템

    Date2017.08.07 CategoryRPGVX Ace script ByLuD Views1480 Votes0
    Read More
  18. [RPG MV] 퀘스트 마커 지속 표시 플러그인

    Date2017.04.09 CategoryRPGMV Plugin Bylklslel Views1881 Votes0
    Read More
  19. Mirror Area - RPG Maker MV

    Date2017.01.03 CategoryRPGMV Plugin By러닝은빛 Views5182 Votes0
    Read More
  20. Keyboard Event - RPG Maker MV

    Date2017.01.03 CategoryRPGMV Plugin By러닝은빛 Views2461 Votes0
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 15 Next
/ 15


[privacy statements] | [Terms of Use] | [Contact us] | [Sponsorship] | [Indiside History]

Copyright © 1999 - 2016 INdiSide.com/CL3D Co., Ltd. All Rights Reserved.
Owner : Chunmu(Jiseon Lee) | kernys(Wonbae Kim) | Sasinji(Byungkook Kim)