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. 캐릭터 그림자

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1546 Votes0
    Read More
  2. 촬영 기술(부드러운 맵스크롤)

    Date2013.09.24 CategoryRPGXP 스크립트 By청담 Views1650 Votes0
    Read More
  3. game testplay 테스트중 게임속도 상승 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By부초 Views785 Votes0
    Read More
  4. [아힝흥행]레벨한계 돌파 스크립트

    Date2013.09.24 CategoryRPGXP 스크립트 By아힝흥행 Views1096 Votes0
    Read More
  5. 미니맵 스크립트

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

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

    Date2013.09.20 CategoryRPGXP 스크립트 By청담 Views1183 Votes0
    Read More
  8. 게임프레임 조절

    Date2013.09.20 CategoryRPGXP 스크립트 By청담 Views1802 Votes0
    Read More
  9. Wave Filter

    Date2016.01.14 CategoryRPGMV 플러그인 By러닝은빛 Views961 Votes0
    Read More
  10. 전투 도중 멤버교체가 가능해지는 플러그인

    Date2016.01.13 CategoryRPGMV 플러그인 ByWailer Views1298 Votes0
    Read More
  11. Multiple HUD

    Date2016.01.12 CategoryRPGMV 플러그인 By러닝은빛 Views2845 Votes1
    Read More
  12. Custom Icon Sheets (커스텀 아이콘 적용 스크립트)

    Date2016.01.10 CategoryRPGVX Ace 스크립트 Byplam Views470 Votes0
    Read More
  13. Damage Popup by Dargor (데미지 수치 팝업하는 스크립트)

    Date2016.01.10 CategoryRPGVX Ace 스크립트 Byplam Views612 Votes0
    Read More
  14. Crafting System (아이템 조합 시스템)

    Date2016.01.06 CategoryRPGMV 플러그인 Byplam Views1709 Votes0
    Read More
  15. Icon Inventory and Details Window (인벤토리 아이템을 아이콘으로 보이게)

    Date2016.01.06 CategoryRPGMV 플러그인 Byplam Views903 Votes0
    Read More
  16. Advanced Game Time (게임에 시간개념을 적용해주는 플러그인)

    Date2016.01.06 CategoryRPGMV 플러그인 Byplam Views1398 Votes0
    Read More
  17. MBS - Map Zoom plugin (맵을 확대,축소해주는 플러그인)

    Date2016.01.06 CategoryRPGMV 플러그인 ByHT9MAN Views896 Votes0
    Read More
  18. Action Sequence Pack 2 (전투모드 액션 플러그인)

    Date2016.01.05 CategoryRPGMV 플러그인 Byplam Views1821 Votes0
    Read More
  19. [C#] 보안 64비트 정수

    Date2016.01.04 Category유니티 스크립트 By맛난호빵 Views382 Votes0
    Read More
  20. Weather EX 날씨 확장 플러그인입니다.

    Date2016.01.03 CategoryRPGMV 플러그인 ByBeeBee Views1108 Votes0
    Read More
Board Pagination Prev 1 ... 3 4 5 6 7 8 9 10 11 12 ... 15 Next
/ 15






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

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