Time limit

Luca Natale

New member
I want to impose time limits in levels, but instead of using the default timer I am looking for something more the style of Cadillacs and Dinosaurs. One with real time minutes and seconds, and only appears when you're running out of time.
This will also be useful in stages with very strict time limits, like in Streets of Rage 3.
This was another thing I checked forums for and could not find, which surprised me because I'm almost certain something like this has been done before.
 
You're gonna need scripted timer for that. Not only to display in minutes, seconds and even centiseconds but also to do something when timer runs out.
I've made many timers before for games which requires timer such as Blue Bullet Bintang and Fruit Frenzy to show that changes occur every 10 second.
I could share the timer part but the what to do after timer runs out would be different and need to be tailored so suit the design.
 
When it comes to scripting I get a little intimidated, since it's hard for me to understand the code and how it works in OpenBOR. I would really like to learn because I'm sure it's not as hard as I think it is, but so far I have avoided scripts whenever I could help it.
I would still really appreciate seeing your time script. It sure would come in handy even with my rudimentary coding skills, but maybe I might figure it out!
 
I've found one timer which does something simple when timer hits 0, which is simply ends current level.
Code:
name        Timer
health         100
type        none
antigravity    100
subject_to_wall    0
offscreenkill    3000
load        DTime


anim    idle
@script
    if(frame==1){
      void self = getlocalvar("self");
      int Health = getentityproperty(self, "health");

      settextobj(1, 140, 16, 3, 1000, Health/10);
    }
    if(frame==2){
      void self = getlocalvar("self");
      int Health = getentityproperty(self, "health");

      changeentityproperty(self, "health", Health-10);
      if(Health > 10){
        updateframe(self, 1);
      }
    }
    if(frame==3){
      cleartextobj(1);
    }
@end_script
    delay    1
    offset    1 1
    frame    data/chars/misc/empty.gif
    delay    99
    frame    data/chars/misc/empty.gif
    delay    1
    frame    data/chars/misc/empty.gif
    @cmd    jumptobranch "Lanjut" 1
    frame    data/chars/misc/empty.gif

anim    spawn
    delay    1
    offset    1 1
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif

This timer doesn't display time in seconds and centiseconds but it does do something when timers hits 0. The time length is defined by its health.
Timer in my games was expanded from this.
 
Back
Top Bottom