Skip to content

Instantly share code, notes, and snippets.

@nenjiru
Last active March 4, 2016 02:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nenjiru/6fa3396a0e29dd202d60 to your computer and use it in GitHub Desktop.
Save nenjiru/6fa3396a0e29dd202d60 to your computer and use it in GitHub Desktop.
/**
* 基底クラス
* @file base.js
*/
function Base ()
{
this.position = { x:0, y:0, z:0 };
}
Base.prototype.update = function ()
{
console.log('base update');
};
// --------------------------
/**
* 常にカメラに向くオブジェクト
* @file billbord.js
*/
function Billboard ()
{
Base.apply(this, arguments);
this.lookat = 0;
}
// 継承
Billboard.prototype = new Base;
Billboard.prototype.update = function ()
{
console.log('billboard update');
};
// --------------------------
var frame = (function()
{
var totalFrame = 0
, billboard = new Billboard()
;
return {
update: function()
{
billboard.update();
totalFrame++;
console.log(totalFrame);
}
};
})();
(function ()
{
setInterval(function ()
{
frame.update();
}, 1000/60);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment