Code edit (7 edits merged)
Please save this source code
User prompt
Второй dom создается через 2 секунду, последюущие через 4 секунды
Code edit (1 edits merged)
Please save this source code
User prompt
скорость у NEWDOM такая же как у DOM
User prompt
для dom и newDom сделать отдельную скорость
User prompt
уменьшить скорость передвижения Dom и Newdom В два раза
User prompt
добавить прозрачность newdom 20 процетов
Code edit (3 edits merged)
Please save this source code
User prompt
создавать новый dom каждые 2 секунды
User prompt
создать массив DOM
User prompt
Создавать dom каждые 2 секунды
Code edit (1 edits merged)
Please save this source code
User prompt
сделать изображение Dom прозрачным на 50 процентов
Code edit (3 edits merged)
Please save this source code
User prompt
Добавить dom прозрачность
Code edit (1 edits merged)
Please save this source code
Code edit (4 edits merged)
Please save this source code
User prompt
Enhance the quality of the 'dom' image by increasing its resolution.
User prompt
Улучшить изображение dom
Code edit (1 edits merged)
Please save this source code
User prompt
Повернуть dom на 20 градусов по часовой стрелке
User prompt
Добавить изображение dom в центр экрана
User prompt
Цвет 12243b
User prompt
Цвет 020c34
User prompt
Сделать фон темно голубой
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // test var ButtonBot = Container.expand(function () { var self = Container.call(this); var buttonBotGraphics = self.attachAsset('BUTTON_BOT', { anchorX: 0.5, anchorY: 0.5 }); // Add down event to set landing duration to 100 during jump or double jump self.down = function (x, y, obj) { self.scale.set(0.9); // Add press effect by scaling down if (!player.inAir && !player.doubleJump) { player.rotation -= Math.PI / 2.25; // Rotate 80 degrees counter-clockwise } else if (player.inAir || player.doubleJump) { tween(player, { y: 2732 / 2 - 250 }, { duration: 100, onFinish: function onFinish() { player.inAir = false; player.doubleJump = false; player.y = 2732 / 2 - 250; } }); } if (player.inAir || player.doubleJump) { player.rotation -= Math.PI / 2.25; // Rotate 80 degrees counter-clockwise tween(player, { y: 2732 / 2 - 250 }, { duration: 100, onFinish: function onFinish() { player.inAir = false; player.doubleJump = false; player.y = 2732 / 2 - 250; } }); } }; // Add up event to reset rotation self.up = function (x, y, obj) { self.scale.set(1); // Reset scale to original size if (!player.inAir && !player.doubleJump) { player.rotation += Math.PI / 2.25; // Rotate back 80 degrees clockwise } else if (player.inAir || player.doubleJump) { player.rotation += Math.PI / 2.25; // Rotate back 80 degrees clockwise } }; }); // Create a button top class var ButtonTop = Container.expand(function () { var self = Container.call(this); var buttonTopGraphics = self.attachAsset('BUTTON_TOP', { anchorX: 0.5, anchorY: 0.5 }); // Add down event to trigger jump self.down = function (x, y, obj) { self.scale.set(0.9); // Add press effect by scaling down if (!player.doubleJump) { if (player.inAir) { player.doubleJump = true; tween(player, { y: player.y - 400, rotation: player.rotation - Math.PI * 2 }, { duration: 230, easing: tween.easeInOut, onFinish: function onFinish() { tween(player, { y: 2732 / 2 - 250 }, { duration: 500, onFinish: function onFinish() { player.inAir = false; player.doubleJump = false; player.y = 2732 / 2 - 250; } }); } }); return; } player.inAir = true; tween(player, { y: player.y - 400 }, { duration: 100, onFinish: function onFinish() { tween(player, { y: 2732 / 2 - 250 }, { duration: 700, onFinish: function onFinish() { player.inAir = false; } }); } }); } }; // Add up event to reset scale self.up = function (x, y, obj) { self.scale.set(1); // Reset scale to original size }; }); // Create a player class var Player = Container.expand(function () { var self = Container.call(this); var playerGraphics = self.attachAsset('character', { anchorX: 0.5, anchorY: 0.5 }); // Initialize the inAir flag self.inAir = false; self.doubleJump = false; // Initialize lastY and lastX for tracking changes self.lastY = self.y; self.lastX = self.x; }); /**** * Initialize Game ****/ // Add player to the game var game = new LK.Game({ backgroundColor: 0x12243b }); /**** * Game Code ****/ // Create an array to store 'Dom' images var domImages = []; // Create a new 'Dom' image every 2 seconds initially, then every 4 seconds var domTimer = LK.setTimeout(function createDom() { var newDom = game.addChild(LK.getAsset('Dom', { anchorX: 0.5, anchorY: 0.5 })); newDom.x = 2048 / 2 + 2170; // Center image horizontally newDom.y = 2732 / 2 + 450; // Center image vertically newDom.rotation = Math.PI / 9; // Rotate image by 20 degrees clockwise newDom.alpha = 0.2; // Set transparency to 20% domImages.push(newDom); // After the first Dom, create subsequent Doms every 4 seconds domTimer = LK.setInterval(createDom, 4000); }, 2000); // Set a random interval between 4 to 8 seconds to create SUNDUK function randomSundukCreation() { var randomTime = Math.floor(Math.random() * (10000 - 4000 + 1)) + 4000; LK.setTimeout(function () { createSunduk(); randomSundukCreation(); // Call again for continuous random creation }, randomTime); } // Start the random SUNDUK creation randomSundukCreation(); // Function to create SUNDUK image function createSunduk() { var sunduk = game.addChild(LK.getAsset('Sunduk', { anchorX: 0.5, anchorY: 0.5 })); sunduk.x = 2090; // Center image horizontally sunduk.y = Math.floor(Math.random() * (2732 - 2332 + 1)) + 2332; // Random height between 2332 and 2732 sunduk.rotation = Math.PI / 9; // Rotate image by 20 degrees clockwise sunduk.alpha = 0.5; // Set transparency to 50% } // Function to create UFO image function createUfo() { var ufo = game.addChild(LK.getAsset('Ufo', { anchorX: 0.5, anchorY: 0.5 })); ufo.x = 2090; // Center image horizontally ufo.y = Math.floor(Math.random() * (2732 - 2332 + 1)) + 2332; // Random height between 2332 and 2732 ufo.rotation = Math.PI / 9; // Rotate image by 20 degrees clockwise ufo.alpha = 0.5; // Set transparency to 50% } // Create a new image 123 every 3 seconds on the right side of the screen var image123Timer = LK.setInterval(function () { var newImage123 = game.addChild(LK.getAsset('123', { anchorX: 0.5, anchorY: 0.5 })); newImage123.x = 2048 + newImage123.width / 2; // Position on the right side of the screen newImage123.y = 2732 / 2 + 1290; // Move image down by 600 pixels newImage123.rotation = Math.PI / 9; // Rotate image by 20 degrees clockwise }, 2500); LK.setTimeout(function () { vzriv = game.addChild(LK.getAsset('Vzriv', { anchorX: 0.5, anchorY: 0.5 })); vzriv.x = vzriv.width / 2 + 90; // Position Vzriv at the left center of the screen vzriv.y = 2732 / 2 - 280; // Center Vzriv vertically game.setChildIndex(player, game.children.length - 1); // Move player to the top game.setChildIndex(buttonBot, game.children.length - 1); // Ensure buttonBot is on top game.setChildIndex(buttonTop, game.children.length - 1); // Ensure buttonTop is on top // Remove Vzriv 2.1 seconds after the game starts LK.setTimeout(function () { vzriv.destroy(); }, 2100); }, 1860); // Add image 123 to the center of the screen var image123 = game.addChild(LK.getAsset('123', { anchorX: 0.5, anchorY: 0.5 })); image123.x = 2048 / 2; // Center image horizontally image123.y = 2732 / 2 + 280; // Move image 123 down by 280 pixels image123.rotation = Math.PI / 9; // Rotate image 123 by 20 degrees clockwise // Add 'Dom' image to the center of the screen var domImage = game.addChild(LK.getAsset('Dom', { anchorX: 0.5, anchorY: 0.5 })); domImage.x = 2048 / 2 + 70; // Center image horizontally domImage.y = 2732 / 2 - 305; // Center image vertically domImage.rotation = Math.PI / 9; // Rotate image by 20 degrees clockwise domImage.alpha = 0.2; // Set transparency to 50% // Add a glow effect to the 'Dom' image tween(domImage, { alpha: 0.2 }, { duration: 1000, yoyo: true, repeat: Infinity }); // Add image 'niz' to the bottom of the screen var niz = game.addChild(LK.getAsset('NIZ', { anchorX: 0.5, // Center horizontally anchorY: 0.5 // Align to the bottom })); niz.x = 2048 / 2 - 150; // Center image horizontally niz.y = 2732 - 200; // Position image at the bottom of the screen niz.rotation = Math.PI / 9; game.setChildIndex(niz, 0); // Move 'niz' to the back layer // Function to create ALMAZ image function createAlmaz() { var almaz = game.addChild(LK.getAsset('almaz', { anchorX: 0.5, anchorY: 0.5 })); almaz.x = 2090; // Center image horizontally almaz.y = Math.floor(Math.random() * (2732 - 2332 + 1)) + 2332; // Random height between 2332 and 2732 almaz.rotation = Math.PI / 9; // Rotate image by 20 degrees clockwise almaz.alpha = 0.7; // Set transparency to 70% } // Function to create SKELET image function createSkelet() { var skelet = game.addChild(LK.getAsset('Skelet', { anchorX: 0.5, anchorY: 0.5 })); skelet.x = 2090; // Center image horizontally skelet.y = Math.floor(Math.random() * (2732 - 2332 + 1)) + 2332; // Random height between 2332 and 2732 skelet.rotation = Math.PI / 9; // Rotate image by 20 degrees clockwise skelet.alpha = 0.5; // Set transparency to 50% } // Set a random interval between 4 to 8 seconds to create ALMAZ function randomAlmazCreation() { var randomTime = Math.floor(Math.random() * (10000 - 4000 + 1)) + 4000; LK.setTimeout(function () { createAlmaz(); randomAlmazCreation(); // Call again for continuous random creation }, randomTime); } // Start the random ALMAZ creation randomAlmazCreation(); // Set a random interval between 4 to 8 seconds to create SKELET function randomSkeletCreation() { var randomTime = Math.floor(Math.random() * (10000 - 4000 + 1)) + 4000; LK.setTimeout(function () { createSkelet(); randomSkeletCreation(); // Call again for continuous random creation }, randomTime); } // Start the random SKELET creation randomSkeletCreation(); // Set a random interval between 4 to 8 seconds to create UFO function randomUfoCreation() { var randomTime = Math.floor(Math.random() * (10000 - 4000 + 1)) + 4000; LK.setTimeout(function () { createUfo(); randomUfoCreation(); // Call again for continuous random creation }, randomTime); } // Start the random UFO creation randomUfoCreation(); // Create 'niz' every 2 seconds, except for the first instance var nizTimer = LK.setInterval(function () { var newNiz = game.addChild(LK.getAsset('NIZ', { anchorX: 0.5, anchorY: 0.5 })); newNiz.x = 2048 / 2 + 2000; newNiz.y = 2732 + 580; newNiz.rotation = Math.PI / 9; game.setChildIndex(newNiz, 0); }, 2005); // Add player to the game var ball = game.addChild(LK.getAsset('Ball', { anchorX: 0.5, anchorY: 0.5 })); var uskorenie = game.addChild(LK.getAsset('Uskorenie', { anchorX: 0.5, anchorY: 0.5 })); ball.x = ball.width / 2 - 100; // Shift ball 100 pixels to the left ball.y = 2732 / 2 - 300; // Center ball vertically LK.setTimeout(function () { tween(ball, { x: ball.x + 400 }, { duration: 360, // Reduced duration to double the speed easing: tween.linear, onFinish: function onFinish() { ball.destroy(); // Remove the ball after it moves 200 pixels } }); }, 1500); game.down = function (x, y, obj) {}; var player = game.addChild(new Player()); player.x = player.width / 2 + 200; // Position player 200 units to the right of the center left of the screen player.y = 2732 / 2 - 250; // Move player 150 units down player.rotation = Math.PI / 12; // Set initial rotation to 15 degrees clockwise // Add background to the game var background = game.addChild(LK.getAsset('background_1', { anchorX: 0.5, anchorY: 0.5 })); game.setChildIndex(background, 0); // Move background to the bottom background.x = 2048 / 2; // Center background horizontally background.y = 2732 / 2 + 150; // Move background down by 550 pixels background.rotation = Math.PI / 9; // Rotate background by 20 degrees clockwise // Move background_1 towards its left side var backgroundCounter = 0; var backgroundTimer = LK.setInterval(function () { var newBackground = game.addChild(LK.getAsset('background_1', { anchorX: 0.5, anchorY: 0.5 })); newBackground.x = 2048 / 2 + 2500; // Move background 2048 pixels to the right newBackground.y = 2732 / 2 + 1060; // Move background down by 1100 pixels newBackground.rotation = Math.PI / 9; // Rotate background by 20 degrees clockwise backgroundCounter++; if (backgroundCounter === 1) { LK.clearInterval(backgroundTimer); backgroundTimer = LK.setInterval(function () { var newBackground = game.addChild(LK.getAsset('background_1', { anchorX: 0.5, anchorY: 0.5 })); newBackground.x = 2048 / 2 + 2500; // Move background 2048 pixels to the right newBackground.y = 2732 / 2 + 1060; // Move background down by 1100 pixels newBackground.rotation = Math.PI / 9; // Rotate background by 20 degrees clockwise }, 3200); } else if (backgroundCounter === 2) { LK.clearInterval(backgroundTimer); backgroundTimer = LK.setInterval(function () { var newBackground = game.addChild(LK.getAsset('background_1', { anchorX: 0.5, anchorY: 0.5 })); newBackground.x = 2048 / 2 + 2500; // Move background 2048 pixels to the right newBackground.y = 2732 / 2 + 1060; // Move background down by 1100 pixels newBackground.rotation = Math.PI / 9; // Rotate background by 20 degrees clockwise }, 1000); } }, 500); var gameStarted = false; var gameStartTimer = LK.setTimeout(function () { gameStarted = true; }, 2000); // Add BUTTON_TOP to the game var buttonTop = game.addChild(new ButtonTop()); buttonTop.x = 2048 - buttonTop.width / 2 - 50; // Position buttonTop 50 units to the left of the right edge of the screen buttonTop.y = 2732 - buttonTop.height / 2 - 350; // Position buttonTop 370 units above the bottom edge of the screen // Add BUTTON_BOT to the game var buttonBot = game.addChild(new ButtonBot()); buttonBot.x = 2048 - buttonBot.width / 2 - 50; // Position buttonBot 50 units to the left of the right edge of the screen buttonBot.y = 2732 - buttonBot.height / 2 - 20; // Position buttonBot 20 units above the bottom edge of the screen game.update = function () { if (!gameStarted) { buttonTop.interactive = false; buttonBot.interactive = false; return; } buttonTop.interactive = true; buttonBot.interactive = true; // Update lastY and lastX for player player.lastY = player.y; player.lastX = player.x; game.children.forEach(function (child) { if (child !== player && child !== buttonTop && child !== buttonBot && child !== uskorenie) { if (child === domImage) { child.x -= 7 * Math.cos(child.rotation); // Set speed for domImage child.y -= 7 * Math.sin(child.rotation); // Set speed for domImage } else if (domImages.includes(child)) { child.x -= 7 * Math.cos(child.rotation); // Set speed for newDom images to match domImage child.y -= 7 * Math.sin(child.rotation); // Set speed for newDom images to match domImage } else { child.x -= 15 * Math.cos(child.rotation); // Default speed for other images child.y -= 15 * Math.sin(child.rotation); // Default speed for other images } if (child.y + child.height / 2 < 0 || child.x - child.width / 2 > 2048 || child.y - child.height / 2 > 2732) { // If the image is completely off the screen child.destroy(); // Remove the image } } game.setChildIndex(player, game.children.length - 1); // Move player to the top game.setChildIndex(buttonBot, game.children.length - 1); // Ensure buttonBot is on top game.setChildIndex(buttonTop, game.children.length - 1); // Ensure buttonTop is on top }); // Add shaking effect to the player if (gameStarted) { if (LK.ticks < 130) { // Strong shake for the first second (assuming 60 FPS) player.x = player.lastX + Math.sin(LK.ticks / 0.5) * 10; player.y = player.lastY + Math.cos(LK.ticks / 0.5) * 10; } else { player.x = player.lastX + Math.sin(LK.ticks / 0.5) * 3; player.y = player.lastY + Math.cos(LK.ticks / 0.5) * 3; } if (vzriv && vzriv.parent) { vzriv.destroy(); } } };
===================================================================
--- original.js
+++ change.js
@@ -138,10 +138,10 @@
* Game Code
****/
// Create an array to store 'Dom' images
var domImages = [];
-// Create a new 'Dom' image every 2 seconds
-var domTimer = LK.setInterval(function () {
+// Create a new 'Dom' image every 2 seconds initially, then every 4 seconds
+var domTimer = LK.setTimeout(function createDom() {
var newDom = game.addChild(LK.getAsset('Dom', {
anchorX: 0.5,
anchorY: 0.5
}));
@@ -149,8 +149,10 @@
newDom.y = 2732 / 2 + 450; // Center image vertically
newDom.rotation = Math.PI / 9; // Rotate image by 20 degrees clockwise
newDom.alpha = 0.2; // Set transparency to 20%
domImages.push(newDom);
+ // After the first Dom, create subsequent Doms every 4 seconds
+ domTimer = LK.setInterval(createDom, 4000);
}, 2000);
// Set a random interval between 4 to 8 seconds to create SUNDUK
function randomSundukCreation() {
var randomTime = Math.floor(Math.random() * (10000 - 4000 + 1)) + 4000;
@@ -403,13 +405,13 @@
player.lastX = player.x;
game.children.forEach(function (child) {
if (child !== player && child !== buttonTop && child !== buttonBot && child !== uskorenie) {
if (child === domImage) {
- child.x -= 5 * Math.cos(child.rotation); // Set speed for domImage
- child.y -= 5 * Math.sin(child.rotation); // Set speed for domImage
+ child.x -= 7 * Math.cos(child.rotation); // Set speed for domImage
+ child.y -= 7 * Math.sin(child.rotation); // Set speed for domImage
} else if (domImages.includes(child)) {
- child.x -= 5 * Math.cos(child.rotation); // Set speed for newDom images to match domImage
- child.y -= 5 * Math.sin(child.rotation); // Set speed for newDom images to match domImage
+ child.x -= 7 * Math.cos(child.rotation); // Set speed for newDom images to match domImage
+ child.y -= 7 * Math.sin(child.rotation); // Set speed for newDom images to match domImage
} else {
child.x -= 15 * Math.cos(child.rotation); // Default speed for other images
child.y -= 15 * Math.sin(child.rotation); // Default speed for other images
}
создать мультяшного сидячего персонажа. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
snowball. 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
Ufo (летающая тарелка). Мультяшная. 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
Куст в снегу мультяшный. 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
снежинка. мультяшная. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows
text: New Record! Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows