September 2010
Beginner
384 pages
8h 49m
English
Let's set the startTime variable, and build the logic to handle the counting-down functionality of our clock.
startTime variable:function Start() {
startTime = 5.0;
}
Note: five seconds to beat the game is a bit ridiculous. We're just keeping the time tight for testing. You can crank this variable up later.
function DoCountdown()
{
timeRemaining = startTime - Time.time;
}
TimeIsUp() function:timeRemaining = startTime - Time.time;
if (timeRemaining < 0)
{
timeRemaining = 0;
isPaused = true;
TimeIsUp();
}
Debug statements so that you can see something happening:function DoCountdown() { ...Read now
Unlock full access