/**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ var top = game.addChild(LK.getAsset('Top', { anchorX: 0.5, anchorY: 0, x: 2048 / 2, y: 0 })); var shar = game.addChild(LK.getAsset('Shar', { anchorX: 0.5, anchorY: 0.5, x: top.x - 100, y: top.y + top.height / 2 })); var strelka = game.addChild(LK.getAsset('Strelka', { anchorX: 0.5, anchorY: 0.5, x: shar.x + 130, y: shar.y })); var tap = game.addChild(LK.getAsset('Tap', { anchorX: 0.5, anchorY: 0.5, x: strelka.x + 130, y: strelka.y + 5 })); var palka = game.addChild(LK.getAsset('Palka', { anchorX: 0.5, anchorY: 0.5, x: top.x + 320, y: top.y + top.height / 2 })); var scoreIcon = game.addChild(LK.getAsset('Scoreicon', { anchorX: 0.5, anchorY: 0, x: 2048 / 2 + 820, y: 35 })); var taimer = game.addChild(LK.getAsset('Taimer', { anchorX: 0, anchorY: 0, x: 1435, y: 30 })); var ball = game.addChild(LK.getAsset('ball', { anchorX: 0.5, anchorY: 0.5, x: 2048 / 2, y: 2732 - 150 })); ball.update = function () { var dx = circle.x - ball.x; var dy = circle.y - ball.y; var distanceSquared = dx * dx + dy * dy; if (distanceSquared > 900) { var distance = Math.sqrt(distanceSquared); ball.x += dx / distance * 35; ball.y += dy / distance * 35; } else { oldCircle = circle; circle = generateCircle(); if (oldCircle) { LK.setTimeout(function () { if (oldCircle) { oldCircle.destroy(); oldCircle = null; } }, 100); } } }; function generateCircle() { var x = Math.random() * (2048 - 300) + 150; var y = Math.random() * (2732 - 300 - 205) + 150 + 205; scored = false; var newCircle = game.addChild(LK.getAsset('Circle', { anchorX: 0.5, anchorY: 0.5, x: x, y: y })); if (oldCircle && newCircle.intersects(oldCircle)) { newCircle.destroy(); return generateCircle(); } return newCircle; } var score = 0; var scored = false; var oldCircle = null; var circle = generateCircle(); var countdown = 2; var countdownTxt = new Text2('2', { size: 80, fill: "#000000" }); countdownTxt.anchor.set(0, 0); countdownTxt.y += 20; countdownTxt.x += 1100; LK.gui.topLeft.addChild(countdownTxt); var countdownTimer = LK.setInterval(function () { countdown--; countdownTxt.setText(countdown); if (countdown <= 0) { LK.clearInterval(countdownTimer); LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(score); } }, 1000); var scoreTxt = new Text2('0', { size: 80, fill: "#000000" }); scoreTxt.anchor.set(1, 0); scoreTxt.y += 20; LK.gui.topRight.addChild(scoreTxt); game.down = function (x, y, obj) { var dx = circle.x - ball.x; var dy = circle.y - ball.y; var distanceSquared = dx * dx + dy * dy; var dxOld = oldCircle ? oldCircle.x - ball.x : 0; var dyOld = oldCircle ? oldCircle.y - ball.y : 0; var distanceOldSquared = dxOld * dxOld + dyOld * dyOld; if (distanceSquared > 0 && distanceSquared <= 22500 || distanceOldSquared > 0 && distanceOldSquared <= 22500 && !scored) { score++; scored = true; scoreTxt.setText(score); countdown = 2; countdownTxt.setText(countdown); countdownTxt.style = { fill: "#000000" }; LK.clearInterval(countdownTimer); countdownTimer = LK.setInterval(function () { countdown--; countdownTxt.setText(countdown); if (countdown <= 0) { LK.clearInterval(countdownTimer); if (!scored) { LK.setScore(score); LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } scored = false; } }, 1000); scored = false; // Play 'Win' sound LK.getSound('Win').play(); } else { LK.setScore(score); LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } };
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
var top = game.addChild(LK.getAsset('Top', {
anchorX: 0.5,
anchorY: 0,
x: 2048 / 2,
y: 0
}));
var shar = game.addChild(LK.getAsset('Shar', {
anchorX: 0.5,
anchorY: 0.5,
x: top.x - 100,
y: top.y + top.height / 2
}));
var strelka = game.addChild(LK.getAsset('Strelka', {
anchorX: 0.5,
anchorY: 0.5,
x: shar.x + 130,
y: shar.y
}));
var tap = game.addChild(LK.getAsset('Tap', {
anchorX: 0.5,
anchorY: 0.5,
x: strelka.x + 130,
y: strelka.y + 5
}));
var palka = game.addChild(LK.getAsset('Palka', {
anchorX: 0.5,
anchorY: 0.5,
x: top.x + 320,
y: top.y + top.height / 2
}));
var scoreIcon = game.addChild(LK.getAsset('Scoreicon', {
anchorX: 0.5,
anchorY: 0,
x: 2048 / 2 + 820,
y: 35
}));
var taimer = game.addChild(LK.getAsset('Taimer', {
anchorX: 0,
anchorY: 0,
x: 1435,
y: 30
}));
var ball = game.addChild(LK.getAsset('ball', {
anchorX: 0.5,
anchorY: 0.5,
x: 2048 / 2,
y: 2732 - 150
}));
ball.update = function () {
var dx = circle.x - ball.x;
var dy = circle.y - ball.y;
var distanceSquared = dx * dx + dy * dy;
if (distanceSquared > 900) {
var distance = Math.sqrt(distanceSquared);
ball.x += dx / distance * 35;
ball.y += dy / distance * 35;
} else {
oldCircle = circle;
circle = generateCircle();
if (oldCircle) {
LK.setTimeout(function () {
if (oldCircle) {
oldCircle.destroy();
oldCircle = null;
}
}, 100);
}
}
};
function generateCircle() {
var x = Math.random() * (2048 - 300) + 150;
var y = Math.random() * (2732 - 300 - 205) + 150 + 205;
scored = false;
var newCircle = game.addChild(LK.getAsset('Circle', {
anchorX: 0.5,
anchorY: 0.5,
x: x,
y: y
}));
if (oldCircle && newCircle.intersects(oldCircle)) {
newCircle.destroy();
return generateCircle();
}
return newCircle;
}
var score = 0;
var scored = false;
var oldCircle = null;
var circle = generateCircle();
var countdown = 2;
var countdownTxt = new Text2('2', {
size: 80,
fill: "#000000"
});
countdownTxt.anchor.set(0, 0);
countdownTxt.y += 20;
countdownTxt.x += 1100;
LK.gui.topLeft.addChild(countdownTxt);
var countdownTimer = LK.setInterval(function () {
countdown--;
countdownTxt.setText(countdown);
if (countdown <= 0) {
LK.clearInterval(countdownTimer);
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver(score);
}
}, 1000);
var scoreTxt = new Text2('0', {
size: 80,
fill: "#000000"
});
scoreTxt.anchor.set(1, 0);
scoreTxt.y += 20;
LK.gui.topRight.addChild(scoreTxt);
game.down = function (x, y, obj) {
var dx = circle.x - ball.x;
var dy = circle.y - ball.y;
var distanceSquared = dx * dx + dy * dy;
var dxOld = oldCircle ? oldCircle.x - ball.x : 0;
var dyOld = oldCircle ? oldCircle.y - ball.y : 0;
var distanceOldSquared = dxOld * dxOld + dyOld * dyOld;
if (distanceSquared > 0 && distanceSquared <= 22500 || distanceOldSquared > 0 && distanceOldSquared <= 22500 && !scored) {
score++;
scored = true;
scoreTxt.setText(score);
countdown = 2;
countdownTxt.setText(countdown);
countdownTxt.style = {
fill: "#000000"
};
LK.clearInterval(countdownTimer);
countdownTimer = LK.setInterval(function () {
countdown--;
countdownTxt.setText(countdown);
if (countdown <= 0) {
LK.clearInterval(countdownTimer);
if (!scored) {
LK.setScore(score);
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
scored = false;
}
}, 1000);
scored = false;
// Play 'Win' sound
LK.getSound('Win').play();
} else {
LK.setScore(score);
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
};
Песочные часы, черный. 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.
Carrot, черный цвет. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.