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 / Run more than 1 function at same time with timer

Author
Message
tonycrew
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location:
Posted: 11th Mar 2010 00:11
Hi again, so far in my cafe sim type game i have a function that cooks the pizzas, which at present take 6 seconds to cook eventually i want this to take maybe 10 mins or so, but while the timer is running the screen you can't cook another pizza as the game kind of pauses, Is there another way to do this function with a time so that the other things in the game can still be accessed.



Thanks again for any help.

FPS Creator Updated 116,Vista 32Bit UpTo Date, nVidea 8500 1Gig Graphics Card, 4 Gig DDR2 Ram, Intel Duel Core 3GHZ CPU
Dia
19
Years of Service
User Offline
Joined: 16th Jan 2005
Location:
Posted: 11th Mar 2010 10:23
inside your cookPizza function, you force the time variable to 6000 then count down to 0 - EVERY SINGLE LOOP and hence the 'pause' effect

a way to get around it is to use the 'Time = 6000' line when you initialise the cooking process, then use a function or a subroutine to decrement the Time variable every game loop

also by decrementing the time variable every loop, then the time to count down from 6000 to 0 will vary depending on how fast the computer is. You can use a timer function to regulate the countdown spped, search the various boards for uses of the timer function

This is not the Sig you are looking for....

Login to post a reply

Server time is: 2024-11-24 20:30:05
Your offset time is: 2024-11-24 20:30:05