RPGXP 스크립트
2013.09.24 07:25

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

조회 수 1650 추천 수 0 댓글 2
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
#==============================================================================
# ★ 촬영 기술 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. 부드러운화면이동

    Date2010.10.24 CategoryRPGXP 스크립트 ByA.M.S Views2375 Votes0
    Read More
  2. 직업명 표시

    Date2010.10.24 CategoryRPGXP 스크립트 ByA.M.S Views2103 Votes0
    Read More
  3. 그레고리우스력 원리.

    Date2011.06.22 CategoryRPGXP 스크립트 By협객 Views2506 Votes0
    Read More
  4. 그레고리우스력 원리.

    Date2011.06.22 CategoryRPGXP 스크립트 By협객 Views2752 Votes0
    Read More
  5. vx 전용 오토세이브<자동저장>

    Date2011.08.31 CategoryRPGVX 스크립트 By고진수 Views2729 Votes0
    Read More
  6. vx 전용 오토세이브<자동저장>

    Date2011.08.31 CategoryRPGVX 스크립트 By고진수 Views2800 Votes0
    Read More
  7. UNR (아시려나... ) - 상태 이상

    Date2013.01.20 CategoryRPGXP 스크립트 By동동주 Views936 Votes0
    Read More
  8. UNR (아시려나... ) - 상태 이상

    Date2013.01.20 CategoryRPGXP 스크립트 By동동주 Views1082 Votes0
    Read More
  9. 게임프레임 조절

    Date2013.09.20 CategoryRPGXP 스크립트 By청담 Views1803 Votes0
    Read More
  10. 모든 글자에 외곽선 넣는 스크립트

    Date2013.09.20 CategoryRPGXP 스크립트 By청담 Views1183 Votes0
    Read More
  11. 맵 이름 표시 스크립트

    Date2013.09.20 CategoryRPGXP 스크립트 By청담 Views1438 Votes0
    Read More
  12. 미니맵 스크립트

    Date2013.09.20 CategoryRPGXP 스크립트 By청담 Views1873 Votes0
    Read More
  13. [아힝흥행]레벨한계 돌파 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By아힝흥행 Views1097 Votes0
    Read More
  14. game testplay 테스트중 게임속도 상승 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By부초 Views785 Votes0
    Read More
  15. 촬영 기술(부드러운 맵스크롤)

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1650 Votes0
    Read More
  16. 캐릭터 그림자

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1546 Votes0
    Read More
  17. 아이디 띄우기

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1027 Votes0
    Read More
  18. 동료가 기차처럼 따라오는 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1117 Votes0
    Read More
  19. 직업명 띄우기

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views769 Votes0
    Read More
  20. 메뉴에 얼굴 그래픽 표시

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views831 Votes0
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 15 Next
/ 15






[개인정보취급방침] | [이용약관] | [제휴문의] | [후원창구] | [인디사이드연혁]

Copyright © 1999 - 2016 INdiSide.com/(주)씨엘쓰리디 All Rights Reserved.
인디사이드 운영자 : 천무(이지선) | kernys(김원배) | 사신지(김병국)