class DP3_WindowThingy < Window_Base
def initialize()
super(50, 50, 200, 200)
end #def 닫음
def change_text(text)
return unless text.is_a?(String)
contents.clear #이것을 써야 말이 계속 겹치지 않는다.
draw_text(text, 10, 10, 200, 200)
end #def 닫음
def draw_text(text, x, y, text_width, text_height, alignment = 0)
contents.draw_text(x, y, text_width, text_height, text, alignment)
end #def 닫음
end #class 닫음
이 스크립트를 실행하면 커스텀 윈도우가 생기는데 게임을 종료하지 않는 이상 계속 계속 떠있습니다.
결정버튼(C버튼)을 눌렀을 때 사라지게 하려면 어떻게 할 수 있는 지 알려주시면 감사하겠습니다.
씬에 대한 설명을 게시문에 적어두시지 않았기에 개요를 설명해드리겠습니다.
윈도우나 씬에 존재하는 update 메소드를 이용합니다.
씬의 update 메소드는 매 프레임마다 호출되는 메소드입니다.
1. 윈도우에서 정의하는 경우
# 씬 update 메소드에 해당 윈도우 update 메소드를 추가하셔야 합니다.
# Scene
def update
@window.update
end
# Window
def update
self.dispose if Input.trigger?(:C)
end
2. 씬에서 정의하는 경우
# Scene
def update
@window.dispose if Input.trigger?(:C)
end