Save-Point
Pause Script - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Material Development (https://www.save-point.org/forum-8.html)
+--- Forum: Scripts Database (https://www.save-point.org/forum-39.html)
+--- Thread: Pause Script (/thread-2468.html)



Pause Script - blink_ - 03-06-2008

Pause Script
by Arbiter

I noticed you didn't have a pause script so I thought I would write a quick one, sorry my standards have slipped and I have used scenes, meh, what can you do. I do not usually post scripts as I am very paranoid of criticism and note this is only a small one because you didn't have one already I don't think.
Quote: To pause the game simply press Z on the keyboard while you are on the map
and to unpause just press the Z key again.
Contains a pause graphic - import it into your projects picture folder.

To change the pause graphic import a new graphic into your pictures folder
then go to line 48 and change the word Pause to the name of your graphic.
To change the pause BGM go to line 52 and change the name of the BGM to the
BGM of your choice, 001-Battle01, 002-Battle02 for example.
Code:
#===============================================================================
# Script: Pause
# Version: 1.0
# Author: Arbiter
#===============================================================================
#===============================================================================
# To pause the game simply press Z on the keyboard while you are on the map
# and to unpause just press the Z key again.
# Contains a pause graphic - import it into your projects picture folder.

# To change the pause graphic import a new graphic into your pictures folder
# then go to line 48 and change the word Pause to the name of your graphic.
# To change the pause BGM go to line 52 and change the name of the BGM to the
# BGM of your choice, 001-Battle01, 002-Battle02 for example.
#===============================================================================


class Scene_Pause
   def main
    @spriteset_map = Spriteset_Map.new
    @pause_window = Pause_Window.new
    @pause_window.x = 100
    @pause_window.y = 160
    @pause_window.height = 500
    @pause_window.width = 500
    @pause_window.opacity = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @pause_window.dispose
  end

  def update
    if Input.trigger?(Input::A)
      $scene = Scene_Map.new
      Audio.bgm_stop
    end
  end
end

class Pause_Window < Window_Base
  def initialize
    super(480, 480, 480, 480)
    self.contents = RPG::Cache.picture("pause")
    Audio.bgm_play("Audio/BGM/018-Field01", 100, 100)
  end
end

class Game_Map
  alias arbiter_pause_update :update
  def update
    arbiter_pause_update
    if Input.trigger?(Input::A)
      $scene = Scene_Pause.new
    else
      $game_system.bgm_play(@map.bgm)
    end
  end
end
Here is the pause graphic, do not laugh it was done quick for semi testing.
Content Hidden

I'm also going to write some tutorials for commands (well paste across ones I have already written) and for windows and others when I get some time.