Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Counting down timer doesn't work

Author
Message
dolorismachina
14
Years of Service
User Offline
Joined: 12th Mar 2010
Location:
Posted: 30th May 2010 20:41
Hi everyone. I used TDK's tutorial to put a count down timer into my game. It works fine until i put anything that reuires user's interaction. For example if i put a do loop it still counts down, however it doesn't refresh every second. Anyone knows how to solve it?
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 30th May 2010 22:39 Edited at: 31st May 2010 00:16
We would be guessing as to what is wrong without seeing the code you have. Can you post it in a snippet (click CODE button, paste your code, click CODE button again)?

EDIT: The TGC forum is funny, because when you are on post-approval (which you are because you are fairly new), it still sends the email to those that are watching the thread. So, I ended up seeing your post before it got put up here.

Anyway, within your REPEAT - UNTIL loop, remove the DO-LOOP you have installed. I believe it will work okay for you.

LB
dolorismachina
14
Years of Service
User Offline
Joined: 12th Mar 2010
Location:
Posted: 30th May 2010 23:08
The code below is where the timer goes.


And these two subs below are run at the same time by balloon sub.
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 31st May 2010 03:38 Edited at: 31st May 2010 17:56
You have a do-loop that is inside of a repeat - until loop, which is not allowing it to get back to the code to countdown the timer. Remove the do - loop and just use the repeat - until by itself and it should work. I don't know how big image 8 is, but you might need to paste it first before printing the time left.

EDIT:

Also, remove the do - loop from your balloonMouseCollision subroutine.
dolorismachina
14
Years of Service
User Offline
Joined: 12th Mar 2010
Location:
Posted: 31st May 2010 17:09
Nope i tried that before and it didn't work. What is basically happening the loop stops waiting for user to click an object and the timer refreshes only after click is performed.

I am attaching the game.exe so you can see what is actually happening.

Attachments

Login to view attachments
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 31st May 2010 18:37
From what I can tell, you never will display the time until your score gets above the limit if you leave the do - loop inside of the repeat - until loop.

Also, you have a do - loop in your balloonMouseCollision subroutine, which also should be removed IMO. You are basically waiting there until the user clicks on the balloon. The timer is not going to display. You could also create a function/subroutine to display the timer and call it from within the balloonMouseCollision subroutine, but I would not recommend doing it that way.
dolorismachina
14
Years of Service
User Offline
Joined: 12th Mar 2010
Location:
Posted: 31st May 2010 20:22
Okay i solved it by moving the bit responsible for counting down and displaying the time to ballonMouseCollision sub and it is working now. Thanks for guidance
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 1st Jun 2010 01:26
You're welcome. Good luck with your game.
dolorismachina
14
Years of Service
User Offline
Joined: 12th Mar 2010
Location:
Posted: 1st Jun 2010 02:39
I actually finished it, the timer was one of the two things I needed to finish.

Login to post a reply

Server time is: 2024-11-24 15:39:57
Your offset time is: 2024-11-24 15:39:57