Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

complete game within 20 sec

Explorer ,
Mar 03, 2013 Mar 03, 2013

game limit is 1 min but if user will complete game within 20 sec then he will get 500 bonus points

how to code for this


//this is count up timer script

var intID;

var endTime = getTimer()+(59*1000);

makeTime();

function updateTimer() {

  var t = endTime-getTimer();

  if (t>0) {

  makeTime();

  showTime(t);

  } else {

  stopTimer();

  showTime(0);

  gotoAndStop("over");

  trace("lost");

  }

}

function makeTime() {

clearInterval(intID);

intID = setInterval(updateTimer, 100);

}

function stopTimer() {

  clearInterval(intID);

}

function showTime(t) {

  dispTime.text = (t/1000) >> 0;

}

TOPICS
ActionScript
435
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Mar 03, 2013 Mar 03, 2013

Wherever in your code where the game is ended, you need to check the time value to see if it is <20 seconds and add the bonus to the score if it is.

Translate
LEGEND ,
Mar 03, 2013 Mar 03, 2013
LATEST

Wherever in your code where the game is ended, you need to check the time value to see if it is <20 seconds and add the bonus to the score if it is.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines