Created
August 22, 2013 12:36
-
-
Save krearthur/6306605 to your computer and use it in GitHub Desktop.
Gist Pseudo Game!
Just a pseudo non working incomplete game framework with errors :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create incredible PSEUDO game | |
(function(){ | |
var GistGame = { | |
title: "Gist Pseudo Game", | |
players: 4, | |
genre: "action", | |
start: function(playTime, wantFrameRate, aCanvas){ | |
var canvasObject = aCanvas; | |
var frameRate = 1000/wantFrameRate; | |
this.onStart(); | |
while(playTime > 0){ | |
window.setTimeout(function(){ | |
var deltaTime = 1/frameRate; | |
this.getInput(); | |
this.update(deltaTime); | |
this.render(); | |
playTime -= deltaTime; | |
}, frameRate); | |
} | |
this.onEnd(); | |
}, | |
getInput: function(){ | |
// listen for inputs | |
} | |
update: function(deltaTime){ | |
// update "everything" and multiply by deltaTime | |
}, | |
render: function(){ | |
// render everything | |
canvasObject.render(); | |
}, | |
// --- Events ---- | |
onStart: cbStart, | |
onEnd: cbEnd | |
} | |
// 120 seconds to play, with 60 frames per second | |
//GistGame.start(120, 60, needCanvas); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
anyone who makes this (theoretically) work will get a yummy cookie!