//thanks to GameAlchemist
function createCountDown(timeRemaining) {
var startTime = Date.now();
return function() {
return timeRemaining - ( Date.now() - startTime );
}
}
var currentCountDown = createCountDown(30000);
// Draw everything
var render = function () {
var countDownValue = currentCountDown();
returnKillsNeeded(stageNum);
ctx.drawImage(startGameImg, 0,0);
ctx.font = "24px Helvetica";
ctx.textAlign = 'center'
ctx.textBaseline = "top";
ctx.fillStyle="#FF0000";
ctx.fillText("press Enter to play", 250, 450);
ctx.fill();
if(gameStart){
if (bgReady) {
ctx.drawImage(bgImage, 0, 0);
}
ctx.fillStyle="#522900";
ctx.fillRect(0,480,500,120);
ctx.drawImage(scoreImg, 22,522);
ctx.drawImage(livesImg, 360,522);
ctx.drawImage(progressImg, 200,492);
createProgressBar();
createProgressPercent();
ctx.fillText("progress", 170,492);
setEnemyHealthText();
drawPlayer();
if(countDownValue <=0){
countDownValue = 0;
}else{
ctx.fillText(countDownValue, 200,190);
}
ardywijaya1997
-2
Newbie Poster
rproffitt
commented:
You did it again. Dump code and not much else.
-2
Recommended Answers
Jump to PostI'm still beginner. I still learn si I ask you to help me
OP, that doesn't work. I too am a "beginner" at whatever language you are using since I don't know what the language is (it doesn't get much more "beginner" than that, does it? :)) So …
All 4 Replies
rproffitt
2,563
"Nothing to see here."
Moderator
ardywijaya1997
-2
Newbie Poster
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
AssertNull
1,094
Practically a Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.