var Timer = Container.expand(function () {
var self = Container.call(this);
self.time = 0;
self.updateTime = function () {
if (LK.ticks % 75 === 0) {
self.time += 1;
}
};
self.getTime = function () {
return self.time;
};
});
var Game = Container.expand(function () {
var self = Container.call(this);
var timer = self.addChild(new Timer());
var timerDisplay = new Text2('Timer: 0', {
size: 150,
fill: "#ffffff",
align: 'center'
});
timerDisplay.anchor.set(0.5, 0.5);
timerDisplay.x = 2048 / 2;
timerDisplay.y = 2732 / 2;
LK.gui.addChild(timerDisplay);
LK.on('tick', function () {
timer.updateTime();
timerDisplay.setText('Timer: ' + timer.getTime());
});
});