XP 스크립트

http://www.dubealex.com/asylum/index.php?showtopic=4702
  문자 그대로 링 메뉴의 명령항목과 아이콘등을 비교적 쉽게 바꿀 수 있도록 하는 것입니다.  링 메뉴 전체가 아니라 class Window_RingMenu부분만 수정한 것입니다.


#==============================================================================
# Window_RingMenu
#-----------------------------------------------------------------
#  Created By SephirothSpawn (10.29.05)
#    Last Updated: (11.11.05)
#==============================================================================

#==============================================================================
# Class Window Ring Menu
#==============================================================================
class Window_RingMenu < Window_Base
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :index
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(commands, icons, radius = 64, center_x = nil, center_y = nil, width = 640, height = 480)
    # Sets Up Window
    super(0, 0, width, height)
    # Sets Center Coordinates to player Center by Default
    center_x = $game_player.screen_x - 30 if center_x == nil
    center_y = $game_player.screen_y - 48 if center_y == nil
    self.contents = Bitmap.new(width-32, height-32)
    # Select Font Type, Size and Color
    self.contents.font.name = "Arial"
    self.contents.font.size = 22
    self.contents.font.color = Color.new(255, 255, 255, 255)
    # Sets up Window Border and Window Background Opacity
    self.opacity, self.back_opacity = 0, 0
    # Sets Up Commands & Icons
    @commands = commands
    @item_max = commands.size
    @index = 0
    @items = icons
    # Sets Up Radius
    @radius = radius
    # Sets Up Disabled Items
    @disabled = Array.new(@item_max, false)
    # Sets Up Center of Ring
    @cx = center_x
    @cy = center_y
    # Disabled Icon
    @icon_disable = RPG::Cache.icon("")
    # Frame Setup
    @startup_frames = 20
    @moving_frames = 5
    setup_move_start
    refresh
  end
  #--------------------------------------------------------------------------
  # * Setup Move Start
  #--------------------------------------------------------------------------
  def setup_move_start
    @mode = 1
    @steps = @startup_frames
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    case @mode
      when 1; refresh_start
      when 2; refresh_wait
      when 3; refresh_move(1)
      when 4; refresh_move(0)
    end
    rect = Rect.new(@cx - 272, @cy + 24, self.contents.width-32, 32)
    self.contents.draw_text(rect, @commands[@index], 1)
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    super
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh Start
  #--------------------------------------------------------------------------
  def refresh_start
    d1 = 2.0 * Math::PI / @item_max
    d2 = 1.0 * Math::PI / @startup_frames
    r = @radius - 1.0 * @radius * @steps / @startup_frames
    for i in 0...@item_max
      j = i - @index + 1
      d = d1 * j + d2 * @steps
      x = @cx + ( r * Math.sin( d ) ).to_i
      y = @cy - ( r * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = 2
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh Wait
  #--------------------------------------------------------------------------
  def refresh_wait
    d = 2.0 * Math::PI / @item_max
    for i in 0...@item_max
      j = i - @index + 1
      x = @cx + ( @radius * Math.sin( d * j ) ).to_i
      y = @cy - ( @radius * Math.cos( d * j ) ).to_i
      draw_item(x, y, i)
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh Move
  #--------------------------------------------------------------------------
  def refresh_move( mode )
    d1 = 2.0 * Math::PI / @item_max
    d2 = d1 / @moving_frames
    d2 *= -1 if mode != 0
    for i in 0...@item_max
      j = i - @index + 1
      d = d1 * j + d2 * @steps
      x = @cx + ( @radius * Math.sin( d ) ).to_i
      y = @cy - ( @radius * Math.cos( d ) ).to_i
      draw_item(x, y, i)
    end
    @steps -= 1
    if @steps < 1
      @mode = 2
    end
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #--------------------------------------------------------------------------
  def draw_item(x, y, i)
    rect = Rect.new(0, 0, @items[i].width, @items[i].height)
    if @index == i
      self.contents.blt( x, y, @items[i], rect )
      if @disabled[@index]
        self.contents.blt( x, y, @icon_disable, rect )
      end
    else
      self.contents.blt( x, y, @items[i], rect, 128 )
      if @disabled[@index]
        self.contents.blt( x, y, @icon_disable, rect, 128 )
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Disable Item
  #--------------------------------------------------------------------------
  def disable_item(index)
    @disabled[index] = true
  end
  #--------------------------------------------------------------------------
  # * Setup Move Move
  #--------------------------------------------------------------------------
  def setup_move_move(mode)
    if mode == 3
      @index -= 1
      @index = @items.size - 1 if @index < 0
    elsif mode == 4
      @index += 1
      @index = 0 if @index >= @items.size
    else
      return
    end
    @mode = mode
    @steps = @moving_frames
  end
  #--------------------------------------------------------------------------
  # * Animation
  #--------------------------------------------------------------------------
  def animation?
    return @mode != 2
  end
end


Scene_Menu에서 호출할 때:
blah = Window_RingMenu.new(commands, icons, radius, center_x, center_y, width, height)

호출 예제:
    # Window Commands
    commands = [ "Item", "Skill", "Equip", "Status", "Save", "Quit" ]
    # Window Icons
    icons = [ RPG::Cache.icon("034-Item03"), RPG::Cache.icon("044-Skill01"),
                  RPG::Cache.icon("001-Weapon01"), RPG::Cache.icon("050-Skill07"),
                  RPG::Cache.icon("038-Item07"), RPG::Cache.icon("046-Skill03")]
    @command_window = Window_RingMenu.new(commands, icons,128)

Who's 백호

?

이상혁입니다.

http://elab.kr


List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 6153
981 전투 펫 시스템(ABS 3.4v포함) 23 file 백호 2009.02.22 3459
980 퍼온것플레이시간을맵위에뜨게하기 3 file 아방스 2007.11.09 2069
979 스킬 패시브 스킬 (출처 RPGXP 포럼 - 후우님) 18 백호 2009.02.21 2915
978 파티 파티원 포션 나눠먹기 스크립트 1 file 백호 2009.02.22 1047
977 파티 파티교환 시스템...이걸로 순서 교체도 가능할 듯... 9 file 백호 2009.02.21 2393
976 파티 파티 확장 11 file 백호 2009.02.22 3184
975 메뉴 파이널 판타지 7 스타일 메뉴 7 아방스 2009.01.12 3238
974 기타 파노라마 스크롤 스크립트 개량판 by Guillaume777 1 백호 2009.02.22 896
973 기타 특수효과 ElseEX 스크립트 file 백호 2009.02.21 995
972 텔로포트 스크립트 8 WMN 2008.03.17 1397
971 이동 및 탈것 텔레포트 스크립트. 11 XP광 2010.01.12 2392
970 이동 및 탈것 텔레포트 마나소비량 수정하기 3 지존!! 2010.07.22 1563
969 키입력 텍스트입력 이벤트명령 2.0 by wachunga@rmxp.org (SDK호환) file 백호 2009.02.22 1825
968 기타 테트리스 ?구현 스크립트 2 file 백호 2009.02.21 1714
967 테두리 글자 & 그림자 글자 12 아방스 2008.09.19 2643
966 이동 및 탈것 테두리 글자 & 그림자 글자 2 file 백호 2009.02.21 2015
965 기타 턴제새로운거. 39 file 이안 2010.01.17 3296
964 전투 턴제 전투메시지 스크립트 10 file 백호 2009.02.21 2199
963 기타 탤레포트 스크립트 3 앞잡이 2011.12.10 2260
962 타크티카르바트르시스템 17 WMN 2008.04.06 3096
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ... 52 Next
/ 52