FG7 - Easy Pause Screen
Easy Pause ScreenBy: FamilyGamer7
Introduction
Quick and easy way to implement a pause screen script. The script leverages the power of $game_switches to perform its action.
Click to expand...
Features
The ability to change the - Pause Button / Pause Screen Picture / Game Switch to help fuel the Pause Screen script. Ideally provides more flexibility than using a static variable created within a defined method.
Click to expand...
Screenshots
- Not Needed -
Click to expand...
Script
Spoiler: FG7 - Easy Pause Screen Ruby:
#==============================================================================
# Title: Easy Pause Screen
# Author: FamilyGamer7 (FG7)
# Version: 1.0
# Engine: RPG Maker VX Ace
#==============================================================================
# ** Change Log |
# ---------------
# 1.0 => Created Script
#==============================================================================
# ** Description |
# ----------------
# Quick and easy way to implement a pause screen script. The script leverages
# the power of $game_switches to perform its action.
#==============================================================================
# ** Terms of Use |
# -----------------
# * Free to use in non-commercial projects and commercial projects
# * Feel free to modify and improve the script. Credit is still required.
# * Credit FamilyGamer7
#==============================================================================
# ** Usage |
# ----------
# - The "Pause_Button" allows you to change any key for the triger to pause
# the screen.
#
# - The "Pause_Screen_Picture" allows you to specify the name of the image you
# want to use once the game is paused.
#
# - The "Game_Switch_Number" allows to set any number value for the game switch
# that is being used. Ideally provides more flexibility than using a static
# variable created within a defined method.
#==============================================================================
# ** Notes |
# ----------
# The Pause screen is designed to not work with the Title Screen (Scene_Title).
# The script also stops the playtime count when the pause screen is active.
#
# List of Keys: /:A :B :C :X :Y :Z :L :R :F5 :F6 :F7 :F8 :F9
# / :DOWN :LEFT :RIGHT :UP :SHIFT :CTRL :ALT
#==============================================================================
#==============================================================================
# ** Module: FG7::Easy_Pause_Screen
#------------------------------------------------------------------------------
#This modules creates a static variable to be used within the script.
#==============================================================================
module FG7
module Easy_Pause_Screen
#==============================================================================
# -------------------- ALLOWED TO EDIT BELOW THIS LINE ---------------------- #
#==============================================================================
# Sets the pause button used to trigger the game frozen/paused
Pause_Button = :X
# Sets the pause background used once the pause is triggered
# (Image to be placed in "Graphic/Pictures/" folder)
Pause_Screen_Picture = "Pause_Background"
# Sets the game switch number used for triggering the pause action
Game_Switch_Number = 19
#==============================================================================
# ---------- DO NOT EDIT BELOW THIS LINE (FOR ADVANCED USERS) --------------- #
#==============================================================================
end
end
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#This class handles system data. It saves the disable state of saving and
# menus. Instances of this class are referenced by $game_system.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * New Method: update_pause (Checks if pause has been triggered)
#--------------------------------------------------------------------------
def update_pause
# Add current frame count into count variable
@update_frame_count = Graphics.frame_count
# Creates Pause Picture bitmap to overlay on screen once pause is triggered
# (The "z" value ensure nothing is above the pause screen)
@pause_screen_pic = Sprite.new
@pause_screen_pic.bitmap = Cache.picture(FG7::Easy_Pause_Screen::Pause_Screen_Picture)
@pause_screen_pic.z = 5000
# If the game switch is not met - do a "return"
return @pause_screen_pic.dispose if $game_switches != true
# Loop and break if game switch is not met and properly unpauses screen
loop do
# Checks if the game switch is not met within the loop to dispose image
if $game_switches != true
@pause_screen_pic.dispose
end
# Breaks if the game switch is not met and updates screen to normal
break if $game_switches != true
$game_switches = $game_switches == true ? false : true if Input.trigger?(FG7::Easy_Pause_Screen::Pause_Button)
# Add count variable back into frame count
Graphics.frame_count = @update_frame_count
# Re-update Input & Graphics
Input.update
Graphics.update
end
end
end
#==============================================================================
# ** Scene_Base
#------------------------------------------------------------------------------
#This is a super class of all scenes within the game.
#==============================================================================
class Scene_Base
#--------------------------------------------------------------------------
# * Alias Method: Frame Update
#--------------------------------------------------------------------------
alias :fg7_easy_pause_screen_update :update
def update
fg7_easy_pause_screen_update
# Performs the updating of the pause screen if conditions are met
# (Pause is not performed on the on Title Screen)
if !SceneManager::scene_is?(Scene_Battle) && !SceneManager::scene_is?(Scene_Title)
$game_system.update_pause
$game_switches = $game_switches == true ? false : true if Input.trigger?(FG7::Easy_Pause_Screen::Pause_Button)
end
end
end
#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
#This class performs battle screen processing.
#==============================================================================
class Scene_Battle < Scene_Base
#--------------------------------------------------------------------------
# * Alias Method: Update Frame (Basic)
#--------------------------------------------------------------------------
alias :fg7_easy_pause_screen_update_basic :update_basic
def update_basic
fg7_easy_pause_screen_update_basic
# Performs the updating of the pause screen if conditions are met
$game_system.update_pause
$game_switches = $game_switches == true ? false : true if Input.trigger?(FG7::Easy_Pause_Screen::Pause_Button)
end
end
How to Use
Add this script in the script editor under in the "Materials" section and above "Main Process".
The instructions and setup for the script are held within the script header itself. No need to repeat here.
Click to expand...
Terms of Use
- Free to use in non-commercial projects and commercial projects
- Feel free to modify and improve the script. Credit is still required.
- Credit FamilyGamer7
Click to expand...
本贴来自国际rpgmaker官方论坛作者:FG7处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/fg7-easy-pause-screen.144477/
页:
[1]