질문과 답변

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 rpg vx ace 클래스 데이터를 읽어오는데 실패했습니다. file 야느와르 2015.10.24 227
RMVXA RPG VX ACE,아이템 제한 갯수 뛰어넘는 방법은? 키보드자판기 2015.10.25 176
RMVXA (재등록)전역저장버그:불러오기 할 시 파일이 없는곳에서 불러올 때 불러와지는 버그 file Enlice_Shaitan 2015.10.27 222
RMVXA 화면 밖의 이벤트가 주인공에게 접근하게 만드는 방법 1 여줄가리 2015.10.27 181
RMVXA 체력바 표시 스크립트 수정 프크 2015.10.29 198
RMVXA 무기의 능력치 조정방법 4 종이상자. 2015.10.29 133
RMVXA 손전등 이벤트좀 도와주세요 1 file 콜라아아 2015.10.30 201
RMVXA 필요없는 메뉴 삭제하는법 1 아쳐 2015.10.30 254
RMVXA 주석 'Light'를 지우고 싶어요! file 뉴리키 2015.11.01 117
RMVXA 떠났던 장소를 기억하는 법! 2 뉴리키 2015.11.01 250
RMVXA 게임중 특정한 상황에서 rgss3 player 오류 file vivid 2015.11.01 1975
RMVXA 게임화면에 변수 출력하고싶어요. 2015.11.01 165
RMVXA 스크립트로 그림(사진) 출력하고싶어요. 4 file 2015.11.02 278
RMVXA [간단] 스크립트 창에서 스크립트 이름을 한글로 작성해도 되나요? 2 불새우 2015.11.04 219
RMVXA 연계 스킬 질문 1 체력을가르다. 2015.11.05 122
RMVXA 변수에 문자 대입하는 방법이 있나요? 4 불새우 2015.11.06 611
RMVXA [변수조작] 변수 여러개에 변수를 대입하는 것은 가능하지만, 그 반대의 경우. 4 불새우 2015.11.06 458
RMVXA RPG쯔꾸르 VX ACE 질문. 스크립트 오류. 2 file pdm0822 2015.11.07 737
RMVXA 스크립트 관련 질문드립니다~ 2 file 불새우 2015.11.07 645
RMVXA (skyborn)전투화면 배경에서 맵이 그대로 보이게 할려면 어떻게 해야 하나요? 대추야자 2015.11.08 155
Board Pagination Prev 1 ... 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 ... 149 Next
/ 149