Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[Resolved] Pause Timer

Status
Not open for further replies.
Here you go, use the following script.
Code:
#==============================================================================
# ** Pause Timer
#------------------------------------------------------------------------------
#  Icarus Featherfight
#  Version: 1.0.0
#  June 19, 2007
#------------------------------------------------------------------------------
#  This simple script allows you to pause the timer using
#  $game_system.pause_timer = true
#  and restart it with
#  $game_system.pause_timer = false
#  in an event script.
#==============================================================================

#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
#  This class handles data surrounding the system. Background music, etc.
#  is managed here as well. Refer to "$game_system" for the instance of 
#  this class.
#==============================================================================

class Game_System
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_accessor :pause_timer              # pauses the timer
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  alias icarus_pausetimer_initialize initialize
  def initialize
    # The usual
    icarus_pausetimer_initialize
    @pause_timer = false
  end 
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  alias icarus_pausetimer_update update
  def update
    unless @pause_timer
      icarus_pausetimer_update
    end
  end
end
That should do the trick. Incidentally, you can also hide the timer with...
Code:
class Sprite_Timer
  alias sprite_timer_update update
  def update
    sprite_timer_update
    # Conditions to hide the timer (switch, $game_temp.in_battle etc.)
    if $game_switches.[](id of switch you created) == true
      # Hide the timer
      self.visible = false
    end
  end
end
Well, that just about covers it. Hopefully it helps.
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top