질문과 답변

Extra Form

안녕하세요 rpgvxace초보게임제작자입니다.

제가 c언어는 조금 읽을줄 아는정도라 스크립트 제작은 거의 초보인데요.

제가 아방스내 게시물중 허걱님이 만들어 올려주신 체력바를 이와같은 스크립트를 쓰는데 당연하게도 한개만 출력할땐 잘나옵니다.

그런데 제가 원하는건 이걸 한개만 띄우는것이 아닌 동시에 두개를 띄우는것이라서 질문올려봅니다.

어떻게 스크립트를 수정하면 두개를 동시에 띄울수 있을까요?


module VariablesDisplayScript

  # 표시 토글 스위치 - 해당 스위치가 ON 일경우 표시

  SWITCH = 1

  

  # 표시위치 - 0:왼쪽 위,  1:오른쪽 위,  2:왼쪽 아래,  3:오른쪽 아래

  POSITION = 0

  

  # 윈도우 넓이

  WINDOW_WIDTH = 200

  

  # 글자 크기

  FONT_SIZE = 20

  

  # 표시할 변수이름, 변수 번호

  # ["이름", 번호1(, 번호2)]

  ITEM = [

  ["공격",1],

  ["방어",2],

  ["체력",4],

  ["4번 변수",6,7],

  ]

end


class Window_VariablesDisplay < Window_Base

  #--------------------------------------------------------------------------

  # ● 초기화

  #--------------------------------------------------------------------------

  def initialize

    super(window_x, window_y, width, height)

    contents.font.size = font_size

    update_visible

    update_values

  end

  #--------------------------------------------------------------------------

  # ● 새로고침

  #--------------------------------------------------------------------------

  def refresh

    contents.clear

    _y = 0

    item.each do |i|

      text = sprintf("%s : %d", i[0],value(i[1]))

      text += sprintf("/%d", value(i[2])) if i[2]

      draw_text(0, _y, text_size(text).width, line_height, text)

      _y += line_height

    end

  end

  #--------------------------------------------------------------------------

  # ● 갱신

  #--------------------------------------------------------------------------

  def update

    super

    update_values if update_visible

  end

  #--------------------------------------------------------------------------

  # ● 투명화 갱신

  #--------------------------------------------------------------------------

  def update_visible

    self.visible = switch_value

  end

  #--------------------------------------------------------------------------

  # ● 내용 갱신

  #--------------------------------------------------------------------------

  def update_values

    unless @values == values

      @values = values

      refresh

    end

  end

  #--------------------------------------------------------------------------

  # ● 스위치 상태 취득

  #--------------------------------------------------------------------------

  def switch_value

    $game_switches[VariablesDisplayScript::SWITCH]

  end

  #--------------------------------------------------------------------------

  # ● 값 배열 취득

  #--------------------------------------------------------------------------

  def values

    result = []

    item.each do |i|

      result.push(value(i[1]))

      result.push(value(i[2])) if i[2]

    end

    return result.dup

  end

  #--------------------------------------------------------------------------

  # ● 변수의 값 취득

  #--------------------------------------------------------------------------

  def value(n)

    $game_variables[n]

  end

  #--------------------------------------------------------------------------

  # ● 글자 크기

  #--------------------------------------------------------------------------

  def font_size

    VariablesDisplayScript::FONT_SIZE

  end

  #--------------------------------------------------------------------------

  # ● 한 줄의 높이

  #--------------------------------------------------------------------------

  def line_height

    font_size

  end

  #--------------------------------------------------------------------------

  # ● 변수 아이템

  #--------------------------------------------------------------------------

  def item

    VariablesDisplayScript::ITEM

  end

  #--------------------------------------------------------------------------

  # ● 윈도우 넓이

  #--------------------------------------------------------------------------

  def width

    VariablesDisplayScript::WINDOW_WIDTH

  end

  #--------------------------------------------------------------------------

  # ● 윈도우 높이

  #--------------------------------------------------------------------------

  def height

    fitting_height(item.size)

  end

  #--------------------------------------------------------------------------

  # ● 윈도우 표시 좌표 X

  #--------------------------------------------------------------------------

  def window_x

    case pos

    when 0, 2; 0

    when 1, 3; Graphics.width - width

    end

  end

  #--------------------------------------------------------------------------

  # ● 윈도우 표시 좌표 Y

  #--------------------------------------------------------------------------

  def window_y

    case pos

    when 0, 1; 0

    when 2, 3; Graphics.height - height

    end

  end

  #--------------------------------------------------------------------------

  # ● 윈도우 표시 위치

  #--------------------------------------------------------------------------

  def pos

    VariablesDisplayScript::POSITION

  end

end


class Scene_Map < Scene_Base

  #--------------------------------------------------------------------------

  # ● 시작

  #--------------------------------------------------------------------------

  alias variables_display_script_start start

  def start

    variables_display_script_start

    @window_var_disp = Window_VariablesDisplay.new

  end

  #--------------------------------------------------------------------------

  # ● 종료

  #--------------------------------------------------------------------------

  alias variables_display_script_terminate terminate

  def terminate

    @window_var_disp.dispose

    variables_display_script_terminate

  end

  #--------------------------------------------------------------------------

  # ● 갱신

  #--------------------------------------------------------------------------

  alias variables_display_script_update update

  def update

    @window_var_disp.update

    variables_display_script_update

  end

end


List of Articles
종류 분류 제목 글쓴이 날짜 조회 수
공지 묻고 답하기 가이드 습작 2014.06.14 12451
RMVXA 이벤트위에 가만히 서있어도 이벤트가 동작하는법 1 가시밭 2015.06.10 148
RMVXA 이벤트와 접촉시 전투가 일어나게 하는 이벤트 설정 질문입니다. 4 file repola 2014.04.04 615
RMVX 이벤트와 이벤트의 접촉을 판정하는 방법 혹은 이벤트와 벽 접촉 판정 2 FNS키리토 2015.02.06 203
RMVX 이벤트와 이벤트가 접촉할 시 또 다른 이벤트가 발생하는 것에 대해 물어보려 합니다. 4 file 다라 2012.10.10 1198
RMVX 이벤트와 이벤트가 접촉시 이벤트발동하는법.. kallat 2011.07.31 1405
RMVXA 이벤트오류? 1 file 인삼보이 2013.06.08 604
RMXP 이벤트에서 캐릭터가 나타나게하는법(빨리부탁이요) 2 태권돌이 2014.01.10 696
RMVXA 이벤트에서 사용 가능한 셀프 스위치 초기화 스크립트가 있나요? 3 GloomyDay 2014.05.16 876
RMVXA 이벤트에서 불러오기화면을 여는방법 2 humuri 2014.03.30 625
RMVXA 이벤트에서 문장에 파티원 페이스 그래픽에 따라 달라지게 하는방법 킹덤8456 2017.10.11 100
RMVX 이벤트에서 HP의 증감을 하면 게임오버가 됩니다 2 펀코우뤼 2013.12.27 736
RMVX 이벤트에서 '루프'의 기능은 뭔가요? 3 daorlia 2011.12.14 2008
RMXP 이벤트에도 발소리 넣는법 2 nachthexen 2015.07.23 197
RMVX 이벤트에대해 1 file 아쳐 2015.04.05 132
RMXP 이벤트없이 화면에 그림띄우기 3 펜슬 2011.02.12 619
RMXP 이벤트액알 보스몹 공격패턴 1 나느야꼴뚜기 2013.09.15 1166
기타 이벤트실행시 캐릭터움직이게하기 5 file 물고기이뻐 2014.02.02 712
RMXP 이벤트실행문제 1 file 안개소문 2011.09.03 1924
RMMV 이벤트시 파티원을 조작할 수는 없을까요? 3 닉넴없어 2017.07.02 287
RMMV 이벤트성 전투를 어떻게 발동시키는지 궁금합니다. 2 늘푸른거탑 2018.02.05 92
Board Pagination Prev 1 ... 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 ... 516 Next
/ 516