/****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class for the main coding empire
var CodingEmpire = Container.expand(function () {
var self = Container.call(this);
var empireGraphics = self.attachAsset('empire', {
anchorX: 0.5,
anchorY: 0.5
});
self.level = 1;
self.codePerClick = 1;
self.totalCode = 0;
// Method to handle clicks on the empire
self.click = function () {
self.totalCode += self.codePerClick;
updateCodeDisplay();
};
// Method to upgrade the empire
self.upgrade = function () {
if (self.totalCode >= self.level * 10) {
self.totalCode -= self.level * 10;
self.level++;
self.codePerClick++;
updateCodeDisplay();
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize the coding empire
var codingEmpire = game.addChild(new CodingEmpire());
codingEmpire.x = 2048 / 2;
codingEmpire.y = 2732 / 2;
// Display for total code
var codeDisplay = new Text2('Code: 0', {
size: 100,
fill: 0xFFFFFF
});
codeDisplay.anchor.set(0.5, 0);
LK.gui.top.addChild(codeDisplay);
// Function to update the code display
function updateCodeDisplay() {
codeDisplay.setText('Code: ' + codingEmpire.totalCode);
}
// Handle tap events on the game
game.down = function (x, y, obj) {
if (codingEmpire.containsPoint({
x: x,
y: y
})) {
codingEmpire.click();
}
};
// Handle upgrade every 5 seconds
LK.setInterval(function () {
codingEmpire.upgrade();
}, 5000);
// Update function called every tick
game.update = function () {
// Additional game logic can be added here
};
a developer sitting on his laptop in his cubicle, typing on the keyboard. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
coffee mug. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
coffee cup 8 bit. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows