RMVXA

이벤트의 스크립트로 현재 씬에 접근하는 방법을 알고 싶어요.

by Pogling posted Feb 14, 2014
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

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


이 강좌를 보면서 윈도우 창을 여는데는 성공했습니다만...


지워지지는 않더군요.






이벤트에 있는 스크립트는 

@window = Window_Farm.new($game_farm.get_self())


이렇게 윈도우를 만들었구요...




class Window_Farm < Window_Base

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

  # ● 오브젝트 초기화

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

  def initialize( targetFarm )

    super(Graphics.width * 0.1, 10, Graphics.width*0.9, 300)

    change_farm( targetFarm )

  end

  

  def change_text( text )

    return unless text.is_a?(String)

    contents.clear

    draw_text(text, 0, 0, 200, 30)

  end

  

  def change_farm( targetFarm )

    return unless targetFarm.is_a?(Game_Farm)

    contents.clear

    draw_text(targetFarm.getInfo_to_string(), 0, 0, 200, 30)

  end

 

  def update

    self.dispose if Input.trigger?(:C)

  end

  

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

  # ● 텍스트 그리기.

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

  def draw_text(text, x, y, t_w, t_h, aligments = 0)

    contents.draw_text(x, y, t_w, t_h, text, aligments)

  end

  

end




강조해놓은 update부분이 호출되지 않는 것이 문제라는 것은 알겠습니다.


저 update를 호출하기 위해서는 Scene에서 Window.update로 호출해야하는데


이벤트에서 작성한 스크립트

"@window = Window_Farm.new($game_farm.get_self())"

여기서 @window를 scene으로 호출하여 update를 호출하고 싶은데
현재 씬에 있는 메소드를 호출하는 방법을 아시는분은 도움을 주셨으면 감사하겠습니다.



Who's Pogling

profile