퍼스 스크립트

by Man... posted Oct 28, 2008
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄
###############################################################################
#Pause Script Version 1.0                                                                                                                                                  
###############################################################################
module Baelgard


  PAUSE_BUTTON = "X"
  PAUSE_TEXT = "Pause"
  #allow/disallow freezing play time during pause
  STOP_TIME = true
  #Set a switch name to allow/disallow pause
  PAUSE_SW_NAME = "Pause"
  PAUSE_BUTTON2 = eval("Input::#{PAUSE_BUTTON}")
  
  def stopping
    
    viewport1 = Viewport.new(0, 0, 640, 480)
    viewport1.z = 10000

    sprite1 = Sprite.new(viewport1)
    sprite1.tone = Tone.new(0, 0, 0, 0)
    sprite1.bitmap = Cache.system ("pause")
  
    loop do
      Graphics.update
      Input.update
      if Input.trigger?(PAUSE_BUTTON2)
        break
      end
    end

    sprite1.dispose
    sprite1 = nil
   end
  #--------------------------------------------------------------------------

  def can_stop?
    if PAUSE_SW_NAME.is_a?(Numeric)
      return ($game_switches[PAUSE_SW_NAME] rescue true)
    else
      return ($game_switches[$data_system.switches.index(PAUSE_SW_NAME)] rescue true)
    end
   end
  end
#==============================================================================
#  Scene_Map
#==============================================================================

class Scene_Map

  include Baelgard

  alias baelgard_update update
  def update
    if Input.trigger?(PAUSE_BUTTON2) and can_stop?
      tmp = Graphics.frame_count
      stopping
      if STOP_TIME
        Graphics.frame_count = tmp
      end
    end
    baelgard_update
   end
end
#==============================================================================
# Scene_Battle
#==============================================================================

class Scene_Battle
  include Baelgard
  alias baelgard_update update
  def update
    if Input.trigger?(PAUSE_BUTTON2) and can_stop?
      tmp = Graphics.frame_count
       stopping
      if STOP_TIME
        Graphics.frame_count = tmp
      end
    end
    baelgard_update
  end
end