맵관련
2011.01.22 22:17

W키눌러서 미니맵표시

조회 수 2760 추천 수 1 댓글 12
?

단축키

Prev이전 문서

Next다음 문서

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

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
라이센스 GPL v2
출처 똥꾸빵꾸
강의종류 텍스트

#==============================================================================
#  축소 맵의 표시(ver 0.999)
# by 피놀 clum-sea
#==============================================================================


#==============================================================================
# 캐스터 마이즈포인트
#==============================================================================
module PLAN_Map_Window
  WIN_X       = 8         # 윈도우의 X 좌표
  WIN_Y       = 8         # 윈도우의 Y 좌표
  WIN_WIDTH   = 8*32      # 윈도우의 폭
  WIN_HEIGHT  = 6*32      # 윈도우의 높이
  ZOOM        = 4.0       #  프의 축소율(32 * 32 의 타일을 몇분의 1으로 할까)
  WINDOWSKIN  = ""        # 스킨(하늘에서 디폴트)

  ON_OFF_KEY  = Input::R  # 윈도우의 온 오프를 바꾸는 버튼

  SWITCH      = 3         # 맵 윈도우 표시 금지용의 스윗치 번호
                          # (ON로 표시 금지, OFF로 표시 가능)

  WINDOW_MOVE = true      # 윈도우와 플레이어가 겹쳤을 시 자동적으로 이동할까
                          #  (true:하는, false:하지 않는다)
  OVER_X      = 632 - WIN_WIDTH   # 이동 후의 X 좌표(초기 위치와 왕복합니다)
  OVER_Y      = 8         # 이동 후의 Y 좌표(초기 위치와 왕복합니다)

  OPACITY     = 126       # 맵의 투명도
  C_OPACITY   = 192       # 윈도우의 투명도
  VISIBLE     = true      # 최초, 표시할까 하지 않는가(true:하는, false:하지 않는다)
end

#==============================================================================
# 걾 Game_Temp
#==============================================================================
class Game_Temp
  #--------------------------------------------------------------------------
  # ● 공개 인스턴스 변수
  #--------------------------------------------------------------------------
  attr_accessor  :map_visible     # ?맵 윈도우의 표시 상태
  #--------------------------------------------------------------------------
  # ● 오브젝트 초기화
  #--------------------------------------------------------------------------
  alias plan_map_window_initialize initialize
  def initialize
    # 되돌린다
    plan_map_window_initialize
   
    @map_visible = false
  end
end
#==============================================================================
# ■  Scene_Map
#==============================================================================

class Scene_Map
  #--------------------------------------------------------------------------
  # ● 메인 처리
  #--------------------------------------------------------------------------
  alias plan_map_window_main main
  def main
    # 윈도우를 작성
    @map_window         = Window_Map.new
    @map_window.visible = $game_temp.map_visible
    # 되돌린다
    plan_map_window_main
    # 메세지 윈도우를 해방
    @map_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  alias plan_map_window_update update
  def update
    # visible 를 기억
    $game_temp.map_visible = @map_window.visible
    # 되돌린다
    plan_map_window_update
   
    # 금지가 아니면, 변환 처리
    unless $game_switches[PLAN_Map_Window::SWITCH]      
      # 표시되고 있는 경우, 비표시로 한다
      if Input.trigger?(PLAN_Map_Window::ON_OFF_KEY)
        # 표시되어 있지 않은 경우, 표시한다
        if @map_window.visible
          @map_window.visible = false
          # 표시되어 있지 않은 경우, 표시한다
        else
          @map_window.visible = true
        end
      end
    # 금지의 경우는 강제적으로 비표시
    else
      if @map_window.visible
        @map_window.visible = false
      end
    end
    # 표시되고 있을 때만 갱신
    if @map_window.visible
      @map_window.update
    end
  end
  #--------------------------------------------------------------------------
  # ● 플레이어의 장소 이동
  #--------------------------------------------------------------------------
  alias plan_map_window_transfer_player transfer_player
  def transfer_player
    #  visible 를 기억
    visible = @map_window.visible
    @map_window.visible = false
    # 되돌린다
    plan_map_window_transfer_player
    # 맵 윈도우를 해방
    @map_window.dispose
    # 맵 윈도우를 작성
    @map_window = Window_Map.new
    # 표시 설정을 전맵 상태에 되돌린다
    @map_window.visible = visible
  end
end


#==============================================================================
# ■ Window_Map
#==============================================================================

class Window_Map < Window_Base
  #--------------------------------------------------------------------------
  # 타일 맵의 경우
  #--------------------------------------------------------------------------
  def initialize
    x = PLAN_Map_Window::WIN_X
    y = PLAN_Map_Window::WIN_Y
    w = PLAN_Map_Window::WIN_WIDTH
    h = PLAN_Map_Window::WIN_HEIGHT
    super(x, y, w, h)
    unless PLAN_Map_Window::WINDOWSKIN.empty?
      self.windowskin = RPG::Cache.windowskin(PLAN_Map_Window::WINDOWSKIN)
    end
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = PLAN_Map_Window::OPACITY
    self.contents_opacity = PLAN_Map_Window::C_OPACITY
    @map_data = $game_map.data
    # ?귽깑?긞긵귩띿맟
    @tileset = RPG::Cache.tileset($game_map.tileset_name)
    @autotiles = []
    for i in 0..6
      autotile_name = $game_map.autotile_names[i]
      @autotiles[i] = RPG::Cache.autotile(autotile_name)
    end
    # 뙸띪궻긵깒귽깂?댧뭫귩둴뺎
    @old_real_x = $game_player.real_x
    @old_real_y = $game_player.real_y
    # ?긞긵궻멣뫬?궻띿맟
    @all_map = make_all_map
    # ?렑갋뷄?렑귩먠믦
    self.visible = PLAN_Map_Window::VISIBLE
    # ?됪
    refresh
  end
  #--------------------------------------------------------------------------
  # 걶 ?긞긵궻멣뫬?궻띿맟걁뢫룷빾듂븊궖걂
  #--------------------------------------------------------------------------
  def make_all_map
    all_map = Bitmap.new($game_map.width * 32, $game_map.height * 32)
    for y in 0...$game_map.height
      for x in 0...$game_map.width
        for z in 0...3
          tile_num = @map_data[x, y, z]
          next if tile_num == nil
          # 긆?긣?귽깑궻뤾뜃
          if tile_num < 384
            # 뗴?귽깑궻뤾뜃궼궴궽궥
            if tile_num >= 48
              tile_num -= 48
              src_rect = Rect.new(32, 2 * 32, 32, 32)
              all_map.blt(x * 32, y * 32, @autotiles[tile_num / 48], src_rect)
            end
          # 타일 맵의 경우
          else
            tile_num -= 384
            src_rect = Rect.new(tile_num % 8 * 32, tile_num / 8 * 32, 32, 32)
            all_map.blt(x * 32, y * 32, @tileset, src_rect)
          end
        end
      end
    end
    # 전체 맵으로부터 축소 맵에
    w = ($game_map.width / PLAN_Map_Window::ZOOM) * 32
    h = ($game_map.height / PLAN_Map_Window::ZOOM) * 32
    ret_bitmap = Bitmap.new(w, h)
    src_rect = Rect.new(0, 0, all_map.width, all_map.height)
    dest_rect = Rect.new(0, 0, ret_bitmap.width, ret_bitmap.height)
    ret_bitmap.stretch_blt(dest_rect, all_map, src_rect)
    all_map.dispose
    return ret_bitmap
  end
  #--------------------------------------------------------------------------
  # ● 리프레쉬
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    # 축소 맵 표시
    one_tile_size = 32 / PLAN_Map_Window::ZOOM
    x = $game_player.real_x - 128 * (self.contents.width / one_tile_size) / 2
    y = $game_player.real_y - 128 * (self.contents.height / one_tile_size) / 2
    x = x * one_tile_size / 128
    y = y * one_tile_size / 128
   
    # 스크롤 스톱 처리(옆)
    # 캐릭터의 위치(contents 의 중앙)
    half_width = self.contents.width * 128 / 2
    # 캐릭터의 위치(실위치)~맵의 구석까지의 나머지폭
    rest_width = ($game_map.width * 128 - $game_player.real_x) * one_tile_size
    # 윈도우보다 맵의 폭이 작으면
    rev_x = 0
    # 맵이 윈도우보다 작은 경우는 중앙 표시
    if @all_map.width < self.contents.width
      rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
      rev_x -= (self.contents.width - @all_map.width) / 2
      x += rev_x
    # 뜺궕?긞긵궻?귩뮪궑궫귞
    elsif half_width > $game_player.real_x * one_tile_size
      rev_x = (half_width - $game_player.real_x * one_tile_size) / 128
      x += rev_x
    # 오른쪽이 맵의 구석을 넘으면
    elsif half_width > rest_width
      rev_x = -((half_width - rest_width) / 128)
      x += rev_x
    end
   
    # 스크롤 스톱 처리(세로)
    # 캐릭터의 정도 치(contents 의 중앙)
    half_height = self.contents.height * 128 / 2
    # 캐릭터의 위치(실위치)~맵의 구석까지의 나머지 높이
    rest_height = ($game_map.height * 128 - $game_player.real_y) * one_tile_size
    # 윈도우보다 맵의 폭이 작으면
    rev_y = 0
    # 맵이 윈도우보다 작은 경우는 중앙 표시
    if @all_map.height < self.contents.height
      rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
      rev_y -= (self.contents.height - @all_map.height) / 2
      y += rev_y
    # 오른쪽이 맵의 구석을 넘으면
    elsif half_height > $game_player.real_y * one_tile_size
      rev_y = (half_height - $game_player.real_y * one_tile_size) / 128
      y += rev_y
    # 덭궕?긞긵궻?귩뮪궑궫귞
    elsif half_height > rest_height
      rev_y = -((half_height - rest_height) / 128)
      y += rev_y
    end
   
    src_rect = Rect.new(x, y, self.contents.width, self.contents.height)
    self.contents.blt(0, 0, @all_map, src_rect)
    # 윈도우의 이동 처리
    if PLAN_Map_Window::WINDOW_MOVE == true
      # 윈도우의 범위를 취득(범위 오브젝트)
      w = self.x..self.x + self.width
      h = self.y..self.y + self.height
      # 플레이어가 윈도우의 범위내에 들어갔을 경우
      if w === $game_player.screen_x and h === $game_player.screen_y
        # 이동 장소 판정
        # 초기 위치라면
        if self.x == PLAN_Map_Window::WIN_X and self.y == PLAN_Map_Window::WIN_Y
          # 이동 후의 좌표에 이동
          self.x = PLAN_Map_Window::OVER_X
          self.y = PLAN_Map_Window::OVER_Y
        # 초기 위치가 아닌 경우
        else
          # 초기 위치에 이동
          self.x = PLAN_Map_Window::WIN_X
          self.y = PLAN_Map_Window::WIN_Y
        end
      end
    end
    # 액터가 있는 경우는 최초의 액터를 맵에 표시
    if $game_party.actors.size > 0
      # priority 체크 숨는다면 액터비표시
      for i in [2, 1, 0]
        tile = @map_data[$game_player.x, $game_player.y, i]
        next if tile == 0
        return if $game_map.priorities[tile] > 0
      end
      actor = $game_party.actors[0]
      bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
      width = bitmap.width / 4
      height = bitmap.height / 4
      src_rect = Rect.new(0, 0, width, height)
      # 액터를 중앙에 표시
      w = width / PLAN_Map_Window::ZOOM
      h = height / PLAN_Map_Window::ZOOM
      # 타일의 폭만 짝수이므로 반타일분 늦춘다
      x = self.contents.width / 2 - w / 2 + one_tile_size / 2 - rev_x
      y = self.contents.height / 2 - h / 2 - rev_y
      dest_rect = Rect.new(x, y, w, h)
      self.contents.stretch_blt(dest_rect, bitmap, src_rect)
    end
  end
  #--------------------------------------------------------------------------
  # ● 프레임 갱신
  #--------------------------------------------------------------------------
  def update
    super
    if @old_real_x != $game_player.real_x or @old_real_y != $game_player.real_y
      @old_real_x = $game_player.real_x
      @old_real_y = $game_player.real_y
      refresh
    end
  end
  #--------------------------------------------------------------------------
  # ● 피놀님, 잘 쓸께요!!!
  #--------------------------------------------------------------------------
  def dispose
    super
    @all_map.dispose
  end
end

사용법 : 스크립트작성후 시작하고 W키를눌르면 미니맵이나옵니다

  • ?
    푸딩 2011.01.26 21:03

    고솧ㅇㄳㅎ도5ㄴㅇㄱ솓ㄴ56ㄱ쇼ㅗ됴 이런건 왜 들어가있어요?

  • ?
    RPG군 2011.01.28 15:47

    안되네요 ㅠㅠ

  • ?
    キリト 2011.01.29 15:58

    어디에올리면되죠?

  • ?
    tlfqj 2011.02.04 14:48

    으악! 보기만 해도 어려워 보인다

     

  • ?
    배짱이 2011.02.15 18:48
    와~~~ 된다~ 제목을 Mini map이라 쓰니까 쉬워 지네영 마지막 출처는 안쓰는 거네영...ㄷㄷ
  • ?
    짱구1000 2011.02.23 14:41
    와우 저는 이 자격증을 땄는데 완벽하네요
  • ?
    게임 마니오 2011.02.23 15:27
    근데... 몬스터나 NPC표시되는것은 안되나요?
  • ?
    오니오니444 2011.05.25 19:12
    이걸어디다가텋지?
  • ?
    찬양123 2011.05.30 22:49

    오 되네여 ㄳ 합니다.

  • ?
    콩냠냠 2011.07.01 18:07

    감사함니다!!

  • ?
    p5934 2012.08.13 09:57

     감사합니다. 잘쓸게요.

     

  • ?
    홍예찬 2012.09.27 22:57

    감사합니다.


List of Articles
분류 제목 글쓴이 날짜 조회 수 추천 수
공지사항 일본어 스크립트를 번역하기 좋은 번역사이트 두곳입니다 ruby 2010.01.09 22078 0
공지사항 스크립트 게시판 관리자' ruby ' 입니다 ruby 2010.01.09 20725 0
공지사항 일본 스크립트/소스 공유 포럼 4 니오티 2010.01.05 22249 0
대화관련 한글자씩 글자 나오는거 완전판!!(오류 하나도 없음) 만원만주라 2013.07.09 2106 0
전투관련 누구나 쉽게 만드는 액션알피지 6 펜릴 2012.11.25 4344 0
공통 Script 화면이 부드럽게 이동돼는 스크립트 2 ★Best갱신★ 2012.09.27 1999 0
맵관련 혹시나해서 일정키로 스크롤X 화면 부드럽게만...(스크립트를 삭제를 조금 했습니다) 호호리터엉 2012.02.13 1789 0
장르변경 2D 로 가는길! 횡스크롤 이닷! 공냑군 2012.01.24 2045 0
기타 게이지바 스크립트!! 최고!! 12 file 코아 코스튬 2011.08.08 4237 0
대화관련 대화 창에 얼굴 넣기 스크립트 4 file 노르 2011.08.08 3433 0
맵관련 조금 다른 맵표시 스크립트 file 노르 2011.08.08 1886 0
시각적 효과 NPC 위에 이름표시 하기 스크립트 2 file 노르 2011.08.08 2477 0
전투관련 초간단 XAS 오리지널. 1 file 호호리터엉 2011.08.04 2614 0
스킬관련 전투 비슷??????????? 아오오오오옹니 2011.07.29 1844 0
기능추가 전체키 스크립트 8 닉네임이없습니다 2011.07.19 2212 0
기타 이름입력 스크립트 2 닉네임이없습니다 2011.07.16 2207 0
맵관련 맵이름 띄우기 (오류없이 진짜나옵니다) 6 지나가던개 2011.07.06 2244 0
메뉴관련 간단한 링 메뉴 스크립트(처음올리는 스크립트) 1 lts1503 2011.05.22 2171 0
온라인 이것은약간온라인이랑섞인듯? 어쨋든 클릭스크립트!! 2 file 호호리터엉 2011.02.23 2218 0
맵관련 W키눌러서 미니맵표시 12 호호리터엉 2011.01.22 2760 1
맵관련 Shift키누르고 방향키누르면 화면스크롤되는것 7 file 호호리터엉 2011.01.21 2581 0
맵관련 맵이름 띄우기, 케릭터 ID띄우기 15 file 꼬마쟁이 2011.01.05 7388 0
기타 중복일것 같은데;; [한글 이름 입력] 1 꼬마쟁이 2011.01.05 4641 0
Board Pagination Prev 1 2 3 4 5 6 7 Next
/ 7

Copyright ⓒ Nioting All Rights Reserved. (since 1999)    개인정보
        

Fatal error: Cannot access property sessionController::$lifetime in /web/old/xe/modules/session/session.controller.php on line 45