Trouble with countdown timer

0 favourites
From the Asset Store
Tabata timer
$9.99 USD
Template for Tabata timer, fully documented in comments and video
  • Hi guys!

    So, I'm creating a side scroller and there are some powerups. When the player pick up a powerup, I want a countdown timer to show onscreen, displaying how long the powerup will last.

    What I've created so far, and didn't work:

    There are basically two events: the first one to create the timer (there's a text object for the number and a sprite to identify which powerup the time refers to) and the second one where I tried to make the timer actually work. Note that the "else" statement in the first event is for, in case the player picks up a powerup it already has, the game doesn't create a second timer on top of the first, just reset the timer for the powerup duration.

    Any thoughts on what I'm doing wrong?

    P.S: I want the timer to display in the format 5.0 > 4.9 > 4.8 > 4.7...

  • yeah you're changing the text but never changing the timer value

  • But I am changing the timer value on the second event: System > Subtract 0.1 from biggergaps_timer.

  • sure but timer is never set to "on" and no value is added for it to tick down from

  • Oh but "biggergaps_timer" is a number variable. Should I use the timer behavior instead?

  • You don't set the boolean to true so the timer doesn't start, or it's already set to true and so the not true condition doesn't work. If you're checking against whether a boolean is true or false you need to toggle it to those values when you do or do not have an item.

  • Hi , glad to see you again answering my doubts xD

    I don't think I followed. The only boolean in the events is "biggergaps_on" which is set to true when the character collides with the powerup and false when the powerup effect ends (this is all configured in other group, not showing in the screenshot I posted). I'm only checking it on the events I posted to differentiate the countdown timer when the player picks the powerup for the first time from when the player already has the powerup.

  • The event you've shown us is on collision with power up right? It shouldn't need a different event, I would expect it to be in this one or you have 2 on collision with power up events. We need to see that in a screenshot as it may cause the problem you're having.

  • andreluizgollo

    I'm not sure if I understood correctly but is something like this what are you trying to do?

    I use Timers

    https://www.dropbox.com/s/v0gk35eq578h8cf/Timers%20PowerUp.capx?dl=0

  • andreluizgollo

    I'm not sure if I understood correctly but is something like this what are you trying to do?

    I use Timers

    https://www.dropbox.com/s/v0gk35eq578h8cf/Timers%20PowerUp.capx?dl=0

    Hey there tarek2! This is exactly what I need! But still I didn't manage to make it work. *inserts face palm*

    I'm gonna show you my event sheet and what I'm trying to do.

    And this is what happens in game:

    But the timer stays on 5! It doesn't change.

  • Hi andreluizgollo

    I see that you are not updating the txt to the Timer or at least not on the Pictures, how do you update the txt With the current Timer?

    Look at my capx event 5 how I update the Timer

    you can do this:

    Create another event outside the collision event

    Is biggergaps_On >>>Action Update txt to the Timer like I showed you on my Capx

    I hope it helps if not let me know

    Remember on Collision it's a Trigger Once only so whatever subevents and actions you have there it will only Run Once, so you need an Event that its True while the Timer its On

  • tarek2 Yeeeesss! I did it! It is working, even though I don't quite understand what is going on hahahahaha. But yeah, I was really missing that line. Do you know if there is any way that the timer display the whole numbers with ".0"? Like... right now it goes 4.2 > 4.1 > 4 > 3.9... It kinda bothers me xD

    Anyway, big thanks again dude, you're the best

  • tarek2 Yeeeesss! I did it! It is working, even though I don't quite understand what is going on hahahahaha. But yeah, I was really missing that line. Do you know if there is any way that the timer display the whole numbers with ".0"? Like... right now it goes 4.2 > 4.1 > 4 > 3.9... It kinda bothers me xD

    Anyway, big thanks again dude, you're the best

    Try this

  • tarek2 Yeeeesss! I did it! It is working, even though I don't quite understand what is going on hahahahaha. But yeah, I was really missing that line. Do you know if there is any way that the timer display the whole numbers with ".0"? Like... right now it goes 4.2 > 4.1 > 4 > 3.9... It kinda bothers me xD

    Anyway, big thanks again dude, you're the best

    No problem mate Glad you fixed it :)

    here is one way of doing that Timer = 0 I'm not sure if this is what you looking for

    dropbox.com/s/qe14e79f72wnmxp/Timers%20PowerUp2.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • here is one way of doing that Timer = 0 I'm not sure if this is what you looking for

    https://www.dropbox.com/s/qe14e79f72wnmxp/Timers%20PowerUp2.capx?dl=0

    tarek2 Perfect again, dude! Thanks a lot!

    sizcoz Thanks to you too :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)