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.

Timer modification, and an oh-so-simple HUD

I'm working on a little project for school that is something of a hybrid of PacMan and, I dunno, Sonic the Hedgehog. I've been working long and hard on it, but the time has come for the HUD to bring it all together. Also, RMXP's timer is pissing me off.

The Mockup

http://img185.imageshack.us/img185/7974/mockupml0.png[/img]

The Problems
Timers!
I would like two changes to the RMXP timer (or a completely new timer script, even). If possible, I want the timer to also display centiseconds (there are 100 centiseconds in a second) This always makes timers seem like they are counting down faster than they are, and I think it looks cooler. Deciseconds would also work.

I also need the ability to pause the timer via the script event command.

I found 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
But this seems to disable player movement when you go to unpause the timer, which sucks. I have no idea what the hell the script is doing, much less how to fix  it, but I've provided it here to hopefully help out. If a new timer is written, I will need the ability to pause it, resume it, initiate it to x seconds, and I'll need a way to catch that is has reached zero. (Also, it would be nice if I could get rid of it when a level is not in progress)

Popups!
What I've tried to portray in the mockup is that, as the blue dot collects gray dots, a number value "bounces" out of the blue dot. This value corresponds to the amount that variable 0001 is being incremented at any given time (That is to say, if variable 0001 is incremented by five for whatever reason, a 5 will bounce out of the player position). This number would ideally disappear after a second or so. I'd like it to be tied to the default "normal" font. This part is mostly for flair, so I won't be completely heartbroken if it doesn't get done.

Progress!
Finally, the bar on the bottom of the mockup represents the progress towards completion of the level. Specifically, it represents the progress of variable 0001 as it approaches variable 0002. The idea is that when variable 0001 = 0002, the bar is full and the level is complete. I'd like the bar to simply cover the bottom row (32 pixels high) of the screen.

Bonus?!
This part is a bit of a bonus request, because I can easily implement this without lag via events. My intent for the game is that the timer would pause whenever variable 0001 is incremented for 2 seconds. So, as long as variable 0001 is incrementing, the time does not count down. It would be nice to have this cuddled into a script. If would be even nicer if there was a mini timer below the main timer (seconds:deciseconds) that showed how long the player had to increment 0001 before the main timer started counting down again. This part would be totally completely awesome of you.
 

khmp

Sponsor

I know I can do the timer pausing it centiseconds etc and the progress bar. The pause feature while a variable is set to something other than zero is also doable. I don't know about popups numbers. I've never down that before. I'm not saying its not possible it is. It's just new to me :) I will get to work immediately.
 
khmp":1zsmpypn said:
The pause feature while a variable is set to something other than zero is also doable.

I thought I would clarify here. It's not necessarily while it's set to something other than zero, it's whether or not it has increased in the last two seconds.

Again, the idea is that as long as the variable keeps increasing, the timer stays paused. If 2 seconds pass without the variable increasing, then the timer starts again. Functionally, that means that whenever 001 increases, the timer pauses for 2 seconds.

For a perhaps clearer example, the game involves gathering "nutrients" around the map. Every time you get a nutrient, variable 0001 is increased by some number, usually 1 or 3. The idea is to gather all the nutrients on the map. If you are gathering nutrients without pause, the timer doesn't count down. That's what makes it possible to get them all. Of course, you are avoiding obstacles and enemies as you race around, so you probably won't be able to continue getting nutrients without 1 to 2 seconds passing (I may change it to one later, but I'm sure I can edit it later on), therefore the timer does indeed count down. Mostly levels give you only 45 seconds or so on the clock, which seems like an impossibly small amount of time, but since you can pause the clock, it's possible.

Umm, and what are the chances of being able to add time to the clock that's already counting down?
 

khmp

Sponsor

arcthemonkey":2pf9c5dx said:
khmp":2pf9c5dx said:
The pause feature while a variable is set to something other than zero is also doable.

I thought I would clarify here. It's not necessarily while it's set to something other than zero, it's whether or not it has increased in the last two seconds.

Again, the idea is that as long as the variable keeps increasing, the timer stays paused. If 2 seconds pass without the variable increasing, then the timer starts again. Functionally, that means that whenever 001 increases, the timer pauses for 2 seconds.

For a perhaps clearer example, the game involves gathering "nutrients" around the map. Every time you get a nutrient, variable 0001 is increased by some number, usually 1 or 3. The idea is to gather all the nutrients on the map. If you are gathering nutrients without pause, the timer doesn't count down. That's what makes it possible to get them all. Of course, you are avoiding obstacles and enemies as you race around, so you probably won't be able to continue getting nutrients without 1 to 2 seconds passing (I may change it to one later, but I'm sure I can edit it later on), therefore the timer does indeed count down. Mostly levels give you only 45 seconds or so on the clock, which seems like an impossibly small amount of time, but since you can pause the clock, it's possible.

Umm, and what are the chances of being able to add time to the clock that's already counting down?

Oh my apology. Got it. You want it so a separate timer must run to see if changes have been made to a variable if no change has occurred let the Main timer update and run.

Adding time shouldn't be too much of a problem. Just need to figure out the count down behavior with ruby.

The Main timer is what I consider, on the HUD mockup, to be in the upper right.
 

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