/****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class for Breakable Objects
var BreakableObject = Container.expand(function () {
var self = Container.call(this);
var objectGraphics = self.attachAsset('breakableObject', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 100; // Initial health of the object
// Method to reduce health
self.reduceHealth = function (amount) {
self.health -= amount;
if (self.health <= 0) {
self.break();
}
};
// Method to handle breaking of the object
self.break = function () {
// Logic for breaking the object and earning rewards
LK.setScore(LK.getScore() + 10); // Increase score as a reward
self.destroy(); // Remove the object from the game
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize variables
var breakableObjects = [];
var scoreTxt = new Text2('0', {
size: 150,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Function to create a new breakable object
function createBreakableObject(x, y) {
var newObject = new BreakableObject();
newObject.x = x;
newObject.y = y;
breakableObjects.push(newObject);
game.addChild(newObject);
}
// Event handler for tapping on the game
game.down = function (x, y, obj) {
var localPos = game.toLocal(obj.global);
breakableObjects.forEach(function (object) {
if (object.containsPoint(localPos)) {
object.reduceHealth(20); // Reduce health on tap
}
});
};
// Update function called every game tick
game.update = function () {
scoreTxt.setText(LK.getScore());
};
// Create initial breakable objects
createBreakableObject(1024, 1366); // Center of the screen
createBreakableObject(512, 683); // Top-left quarter
createBreakableObject(1536, 2049); // Bottom-right quarter /****
* Classes
****/
//<Assets used in the game will automatically appear here>
//<Write imports for supported plugins here>
// Class for Breakable Objects
var BreakableObject = Container.expand(function () {
var self = Container.call(this);
var objectGraphics = self.attachAsset('breakableObject', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 100; // Initial health of the object
// Method to reduce health
self.reduceHealth = function (amount) {
self.health -= amount;
if (self.health <= 0) {
self.break();
}
};
// Method to handle breaking of the object
self.break = function () {
// Logic for breaking the object and earning rewards
LK.setScore(LK.getScore() + 10); // Increase score as a reward
self.destroy(); // Remove the object from the game
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize variables
var breakableObjects = [];
var scoreTxt = new Text2('0', {
size: 150,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Function to create a new breakable object
function createBreakableObject(x, y) {
var newObject = new BreakableObject();
newObject.x = x;
newObject.y = y;
breakableObjects.push(newObject);
game.addChild(newObject);
}
// Event handler for tapping on the game
game.down = function (x, y, obj) {
var localPos = game.toLocal(obj.global);
breakableObjects.forEach(function (object) {
if (object.containsPoint(localPos)) {
object.reduceHealth(20); // Reduce health on tap
}
});
};
// Update function called every game tick
game.update = function () {
scoreTxt.setText(LK.getScore());
};
// Create initial breakable objects
createBreakableObject(1024, 1366); // Center of the screen
createBreakableObject(512, 683); // Top-left quarter
createBreakableObject(1536, 2049); // Bottom-right quarter
A small piece of wood.
a hanging rope. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
piece_of_wood. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Upgrade button. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Gold_button_icon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
crown. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
raw piece of wood. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Metal. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Chair. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
create a hand icon breaking a brick in half. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Play_button. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Diamond_icon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
pixel person with black hair, black pants, black eyes, and blue clothes making a V with hands jumping in a rain of diamonds. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
Shop_icon. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows