Skip to content

Instantly share code, notes, and snippets.

@krearthur
Created August 22, 2013 12:36
Show Gist options
  • Save krearthur/6306605 to your computer and use it in GitHub Desktop.
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 :)
// 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);
})();
@krearthur
Copy link
Author

anyone who makes this (theoretically) work will get a yummy cookie!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment