/**** * Classes ****/ // Class for the back button var BackButton = Container.expand(function () { var self = Container.call(this); // Create a back button var backButton = self.attachAsset('backButton', { anchorX: 0.0, anchorY: 0.0, x: 0, y: 0 }); backButton.down = function (x, y, obj) { // Hide the shop menu and the back button, and show the bitcoin and the shop button when the back button is pressed shopMenu.visible = false; bitcoin.visible = true; shopButton.visible = true; backButton.visible = false; }; }); // Class for the shop menu var ShopMenu = Container.expand(function () { var self = Container.call(this); // Create a back button var backButton = self.attachAsset('shopButton', { anchorX: 0.0, anchorY: 0.0, x: 0, y: 0 }); backButton.down = function (x, y, obj) { // Hide the shop menu and show the bitcoin when the back button is pressed self.visible = false; bitcoin.visible = true; }; // Create a buy button var buyButton = self.attachAsset('shopButton', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 - 200 }); buyButton.down = function (x, y, obj) { // Check if the player has enough money to buy the upgrade if (LK.getScore() >= 500) { // Deduct the cost of the upgrade from the player's score LK.setScore(LK.getScore() - 500); // Increase the score per click by 1 when the buy button is pressed scorePerClick += 1; } else { // If the player doesn't have enough money, show a message console.log("You don't have enough money to buy this upgrade!"); } }; // Create an autoclicker button var autoclickerButton = self.attachAsset('Avtoclik', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 + 200 }); autoclickerButton.down = function (x, y, obj) { // Check if the player has enough money to buy the autoclicker if (LK.getScore() >= 750) { // Deduct the cost of the autoclicker from the player's score LK.setScore(LK.getScore() - 750); // Activate the autoclicker and set up a function to add 1$ every second autoclickerActive = true; if (!autoclickerInterval) { autoclickerInterval = LK.setInterval(function () { LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); }, 1000); } } else { // If the player doesn't have enough money, show a message console.log("You don't have enough money to buy the autoclicker!"); } }; }); /**** * Initialize Game ****/ // Class for the mine layer // Global variables var game = new LK.Game({ backgroundColor: 0xADD8E6 // Set background color to light blue }); /**** * Game Code ****/ // Create a bitcoin in the center of the game var bitcoin = LK.getAsset('bitcoin', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 / 2 }); game.addChild(bitcoin); // Create a score counter at the top of the screen var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Create a shop button in the top right corner of the game var shopButton = LK.getAsset('shopButton', { anchorX: 1, anchorY: 0, x: 2048, y: 0 }); game.addChild(shopButton); // Create a new instance of the shop menu var shopMenu = game.addChild(new ShopMenu()); // Hide the shop menu initially shopMenu.visible = false; // Create a new instance of the back button var backButton = game.addChild(new BackButton()); // Hide the back button initially backButton.visible = true; shopButton.down = function (x, y, obj) { // Hide the bitcoin and the shop button and show the shop menu and the back button when the shop button is pressed bitcoin.visible = false; shopMenu.visible = true; backButton.visible = true; }; // Create a new variable for the score per click var scorePerClick = 1; // Initialize autoclickerInterval to null to avoid reference errors var autoclickerInterval = null; bitcoin.down = function (x, y, obj) { // Increase the score by the score per click LK.setScore(LK.getScore() + scorePerClick); scoreTxt.setText(LK.getScore()); // Temporarily shrink bitcoin on press bitcoin.scaleX = 0.8; bitcoin.scaleY = 0.8; // After 100ms, expand the bitcoin back to its original size LK.setTimeout(function () { bitcoin.scaleX = 1.2; bitcoin.scaleY = 1.2; // After another 100ms, revert the bitcoin back to its normal size LK.setTimeout(function () { bitcoin.scaleX = 1; bitcoin.scaleY = 1; }, 100); }, 100); // Add a visual effect to the bitcoin when clicked var effect = LK.getAsset('1', { anchorX: 0.5, anchorY: 0.5, x: bitcoin.x, y: bitcoin.y }); game.addChild(effect); // Create particles that will fly off the bitcoin var particles = []; for (var i = 0; i < 5; i++) { var particle = LK.getAsset(i % 2 == 0 ? 'goldPixel' : 'blackPixel', { anchorX: 0.5, anchorY: 0.5, x: bitcoin.x, y: bitcoin.y }); game.addChild(particle); particles.push(particle); } // Animate the particles to fly off in random directions particles.forEach(function (particle) { var angle = Math.random() * Math.PI * 2; var speed = Math.random() * 5 + 2; particle.vx = Math.cos(angle) * speed; particle.vy = Math.sin(angle) * speed; }); // Update the particles every frame game.update = function () { for (var i = particles.length - 1; i >= 0; i--) { var particle = particles[i]; particle.x += particle.vx; particle.y += particle.vy; particle.vy += 0.1; // gravity // Fade out and remove the particle after a while particle.alpha -= 0.01; if (particle.alpha <= 0 || particle.vx === 0 && particle.vy === 0) { game.removeChild(particle); particles.splice(i, 1); particle.destroy(); // Destroy the particle to ensure it doesn't remain in memory } } }; // Remove the effect after 200ms LK.setTimeout(function () { game.removeChild(effect); }, 200); };
/****
* Classes
****/
// Class for the back button
var BackButton = Container.expand(function () {
var self = Container.call(this);
// Create a back button
var backButton = self.attachAsset('backButton', {
anchorX: 0.0,
anchorY: 0.0,
x: 0,
y: 0
});
backButton.down = function (x, y, obj) {
// Hide the shop menu and the back button, and show the bitcoin and the shop button when the back button is pressed
shopMenu.visible = false;
bitcoin.visible = true;
shopButton.visible = true;
backButton.visible = false;
};
});
// Class for the shop menu
var ShopMenu = Container.expand(function () {
var self = Container.call(this);
// Create a back button
var backButton = self.attachAsset('shopButton', {
anchorX: 0.0,
anchorY: 0.0,
x: 0,
y: 0
});
backButton.down = function (x, y, obj) {
// Hide the shop menu and show the bitcoin when the back button is pressed
self.visible = false;
bitcoin.visible = true;
};
// Create a buy button
var buyButton = self.attachAsset('shopButton', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2 - 200
});
buyButton.down = function (x, y, obj) {
// Check if the player has enough money to buy the upgrade
if (LK.getScore() >= 500) {
// Deduct the cost of the upgrade from the player's score
LK.setScore(LK.getScore() - 500);
// Increase the score per click by 1 when the buy button is pressed
scorePerClick += 1;
} else {
// If the player doesn't have enough money, show a message
console.log("You don't have enough money to buy this upgrade!");
}
};
// Create an autoclicker button
var autoclickerButton = self.attachAsset('Avtoclik', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2 + 200
});
autoclickerButton.down = function (x, y, obj) {
// Check if the player has enough money to buy the autoclicker
if (LK.getScore() >= 750) {
// Deduct the cost of the autoclicker from the player's score
LK.setScore(LK.getScore() - 750);
// Activate the autoclicker and set up a function to add 1$ every second
autoclickerActive = true;
if (!autoclickerInterval) {
autoclickerInterval = LK.setInterval(function () {
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
}, 1000);
}
} else {
// If the player doesn't have enough money, show a message
console.log("You don't have enough money to buy the autoclicker!");
}
};
});
/****
* Initialize Game
****/
// Class for the mine layer
// Global variables
var game = new LK.Game({
backgroundColor: 0xADD8E6 // Set background color to light blue
});
/****
* Game Code
****/
// Create a bitcoin in the center of the game
var bitcoin = LK.getAsset('bitcoin', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 / 2
});
game.addChild(bitcoin);
// Create a score counter at the top of the screen
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create a shop button in the top right corner of the game
var shopButton = LK.getAsset('shopButton', {
anchorX: 1,
anchorY: 0,
x: 2048,
y: 0
});
game.addChild(shopButton);
// Create a new instance of the shop menu
var shopMenu = game.addChild(new ShopMenu());
// Hide the shop menu initially
shopMenu.visible = false;
// Create a new instance of the back button
var backButton = game.addChild(new BackButton());
// Hide the back button initially
backButton.visible = true;
shopButton.down = function (x, y, obj) {
// Hide the bitcoin and the shop button and show the shop menu and the back button when the shop button is pressed
bitcoin.visible = false;
shopMenu.visible = true;
backButton.visible = true;
};
// Create a new variable for the score per click
var scorePerClick = 1;
// Initialize autoclickerInterval to null to avoid reference errors
var autoclickerInterval = null;
bitcoin.down = function (x, y, obj) {
// Increase the score by the score per click
LK.setScore(LK.getScore() + scorePerClick);
scoreTxt.setText(LK.getScore());
// Temporarily shrink bitcoin on press
bitcoin.scaleX = 0.8;
bitcoin.scaleY = 0.8;
// After 100ms, expand the bitcoin back to its original size
LK.setTimeout(function () {
bitcoin.scaleX = 1.2;
bitcoin.scaleY = 1.2;
// After another 100ms, revert the bitcoin back to its normal size
LK.setTimeout(function () {
bitcoin.scaleX = 1;
bitcoin.scaleY = 1;
}, 100);
}, 100);
// Add a visual effect to the bitcoin when clicked
var effect = LK.getAsset('1', {
anchorX: 0.5,
anchorY: 0.5,
x: bitcoin.x,
y: bitcoin.y
});
game.addChild(effect);
// Create particles that will fly off the bitcoin
var particles = [];
for (var i = 0; i < 5; i++) {
var particle = LK.getAsset(i % 2 == 0 ? 'goldPixel' : 'blackPixel', {
anchorX: 0.5,
anchorY: 0.5,
x: bitcoin.x,
y: bitcoin.y
});
game.addChild(particle);
particles.push(particle);
}
// Animate the particles to fly off in random directions
particles.forEach(function (particle) {
var angle = Math.random() * Math.PI * 2;
var speed = Math.random() * 5 + 2;
particle.vx = Math.cos(angle) * speed;
particle.vy = Math.sin(angle) * speed;
});
// Update the particles every frame
game.update = function () {
for (var i = particles.length - 1; i >= 0; i--) {
var particle = particles[i];
particle.x += particle.vx;
particle.y += particle.vy;
particle.vy += 0.1; // gravity
// Fade out and remove the particle after a while
particle.alpha -= 0.01;
if (particle.alpha <= 0 || particle.vx === 0 && particle.vy === 0) {
game.removeChild(particle);
particles.splice(i, 1);
particle.destroy(); // Destroy the particle to ensure it doesn't remain in memory
}
}
};
// Remove the effect after 200ms
LK.setTimeout(function () {
game.removeChild(effect);
}, 200);
};
Пиксельная кнопка где нарисована телега на красном фоне. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Пиксельный биткоин золотой. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Пиксельная кнопка назад красно белая. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Пиксельная кнопка авто клик красно белая. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Сделай пиксельный фон голубой с задним фоном где $ строго размерами 2048 на 2732. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.