User prompt
aumenta la velocidad de las flechas y círculos que suben + 0.1
User prompt
155aumenta la velocidad de las flechas y círculos que suben + 0.5
User prompt
aumenta la velocidad de las flechas y círculos que suben + 1
User prompt
aumenta la velocidad de las flechas y círculos que suben + 3
User prompt
aumenta la velocidad de las flechas y círculos que suben x 1
User prompt
disminuye la velocidad de las flechas y círculos que suben - 2
User prompt
aumenta la velocidad de las flechas y círculos que suben x 3
User prompt
disminuye la velocidad de las flechas y círculos que suben X1
User prompt
aumenta la velocidad de las flechas y círculos que suben X 5
User prompt
con click derecho aumenta la velocidad de las del juego
User prompt
aumenta la velocidad de las flechas y círculos que suben cada ves que de 1 click derecho
User prompt
destruye las flechas y círculos que suben cuando les de click izquierdo
User prompt
aumenta la velocidad x 3 cada cada ves que oprima la tecla q del teclado
User prompt
activa el game over cuando 10 flechas o 10 circulos pasen las flechas o circulo de la parte superior
User prompt
activa el game over cuando las flechas y los circulos que suben pasen a las flechas y el circulo de la parte superior
User prompt
destruir las flechas y circulos que suben con los numeros 7 , 9 , 1 ,3 , 5
User prompt
al oprimir la tecla 1 destruye la flecha diagonal a la derecha que suben
User prompt
que las flechas y los circulos que no se destruyan
User prompt
solo perder cuando las flechas o los circulos que esten subiendo esten mas arriba de la pantalla
User prompt
desactiva el game over
User prompt
que suban flechas y circulos de abajo hacia arriba a la misma alineacion que las flechas y el circulo ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
separa las flechas
User prompt
que el circulo este ala misma altura que las flechas
User prompt
separa 5 unidades las 2 primeras flechas
User prompt
que el circulo ente alineado en la parte superior de la pantalla a medias de las flechas
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Arrow = Container.expand(function (direction) {
var self = Container.call(this);
var arrowGraphics = self.attachAsset('arrow', {
anchorX: 0.5,
anchorY: 0.5
});
self.direction = direction;
self.isPressed = false;
// Set rotation based on direction
if (direction === 'up-right') {
arrowGraphics.rotation = -Math.PI / 4;
} else if (direction === 'up-left') {
arrowGraphics.rotation = -3 * Math.PI / 4;
} else if (direction === 'down-right') {
arrowGraphics.rotation = Math.PI / 4;
} else if (direction === 'down-left') {
arrowGraphics.rotation = 3 * Math.PI / 4;
}
self.highlight = function () {
arrowGraphics.tint = 0xFFFF00;
self.isPressed = true;
};
self.unhighlight = function () {
arrowGraphics.tint = 0xFFFFFF;
self.isPressed = false;
};
self.down = function (x, y, obj) {
checkArrowPress(self.direction);
};
return self;
});
var GameCircle = Container.expand(function () {
var self = Container.call(this);
var circleGraphics = self.attachAsset('circle', {
anchorX: 0.5,
anchorY: 0.5
});
self.originalX = 0;
self.originalY = 0;
self.moveInDirection = function (direction) {
var targetX = self.originalX;
var targetY = self.originalY;
var moveDistance = 50;
if (direction === 'up-right') {
targetX += moveDistance;
targetY -= moveDistance;
} else if (direction === 'up-left') {
targetX -= moveDistance;
targetY -= moveDistance;
} else if (direction === 'down-right') {
targetX += moveDistance;
targetY += moveDistance;
} else if (direction === 'down-left') {
targetX -= moveDistance;
targetY += moveDistance;
}
tween(self, {
x: targetX,
y: targetY
}, {
duration: 200,
easing: tween.easeOut,
onFinish: function onFinish() {
tween(self, {
x: self.originalX,
y: self.originalY
}, {
duration: 200,
easing: tween.easeOut
});
}
});
};
return self;
});
var MovingArrow = Container.expand(function (direction) {
var self = Container.call(this);
var arrowGraphics = self.attachAsset('arrow', {
anchorX: 0.5,
anchorY: 0.5
});
self.direction = direction;
self.speed = 15;
self.targetY = 300; // Same height as static arrows
self.lastY = undefined;
// Set rotation based on direction
if (direction === 'up-right') {
arrowGraphics.rotation = -Math.PI / 4;
} else if (direction === 'up-left') {
arrowGraphics.rotation = -3 * Math.PI / 4;
} else if (direction === 'down-right') {
arrowGraphics.rotation = Math.PI / 4;
} else if (direction === 'down-left') {
arrowGraphics.rotation = 3 * Math.PI / 4;
}
self.update = function () {
// Track last Y position
if (self.lastY === undefined) self.lastY = self.y;
// Move upward
self.y -= self.speed;
};
self.down = function (x, y, obj) {
// Destroy this arrow when clicked
for (var i = movingArrows.length - 1; i >= 0; i--) {
if (movingArrows[i] === self) {
self.destroy();
movingArrows.splice(i, 1);
break;
}
}
};
return self;
});
var MovingCircle = Container.expand(function () {
var self = Container.call(this);
var circleGraphics = self.attachAsset('circle', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self.targetY = 300; // Same height as static circle
self.lastY = undefined;
self.update = function () {
// Track last Y position
if (self.lastY === undefined) self.lastY = self.y;
// Move upward
self.y -= self.speed;
};
self.down = function (x, y, obj) {
// Destroy this circle when clicked
for (var i = movingCircles.length - 1; i >= 0; i--) {
if (movingCircles[i] === self) {
self.destroy();
movingCircles.splice(i, 1);
break;
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x1a1a1a
});
/****
* Game Code
****/
var gameCircle;
var arrows = [];
var movingArrows = [];
var movingCircles = [];
var currentCommand = '';
var gameSpeed = 2000;
var minSpeed = 800;
var speedIncrease = 50;
var isGameActive = false;
var commandTimeout;
var passedArrowsCount = 0;
var passedCirclesCount = 0;
// UI Elements
var scoreTxt = new Text2('0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var commandTxt = new Text2('', {
size: 60,
fill: 0xFFFFFF
});
commandTxt.anchor.set(0.5, 0.5);
// Position command text
commandTxt.x = 2048 / 2;
commandTxt.y = 400;
game.addChild(commandTxt);
// Create game circle
gameCircle = game.addChild(new GameCircle());
gameCircle.x = 2048 / 2;
gameCircle.y = 300; // Position circle at the same height as arrows
gameCircle.originalX = gameCircle.x;
gameCircle.originalY = gameCircle.y;
// Create arrows aligned at the top of the screen
var arrowPositions = [{
dir: 'up-right',
x: 2048 / 2 + 400,
y: 300
}, {
dir: 'up-left',
x: 2048 / 2 + 150,
y: 300
}, {
dir: 'down-right',
x: 2048 / 2 - 150,
y: 300
}, {
dir: 'down-left',
x: 2048 / 2 - 400,
y: 300
}];
for (var i = 0; i < arrowPositions.length; i++) {
var arrow = new Arrow(arrowPositions[i].dir);
arrow.x = arrowPositions[i].x;
arrow.y = arrowPositions[i].y;
arrows.push(arrow);
game.addChild(arrow);
}
// Game functions
function getRandomDirection() {
var directions = ['up-right', 'up-left', 'down-right', 'down-left'];
return directions[Math.floor(Math.random() * directions.length)];
}
function generateCommand() {
if (!isGameActive) return;
currentCommand = getRandomDirection();
commandTxt.setText(currentCommand.toUpperCase());
// Flash command text
tween(commandTxt, {
alpha: 0.3
}, {
duration: 100,
onFinish: function onFinish() {
tween(commandTxt, {
alpha: 1
}, {
duration: 100
});
}
});
// Set timeout for next command
commandTimeout = LK.setTimeout(function () {
if (isGameActive) {
// Player didn't respond in time - just generate new command
currentCommand = '';
commandTxt.setText('');
generateCommand();
}
}, gameSpeed);
}
function checkArrowPress(direction) {
if (!isGameActive || currentCommand === '') return;
// Clear timeout
LK.clearTimeout(commandTimeout);
// Find and highlight the pressed arrow
for (var i = 0; i < arrows.length; i++) {
if (arrows[i].direction === direction) {
arrows[i].highlight();
LK.setTimeout(function () {
arrows[i].unhighlight();
}, 200);
break;
}
}
if (direction === currentCommand) {
// Correct answer
LK.getSound('correct').play();
LK.setScore(LK.getScore() + 10);
scoreTxt.setText(LK.getScore());
// Move circle in correct direction
gameCircle.moveInDirection(direction);
// Increase speed slightly
gameSpeed = Math.max(minSpeed, gameSpeed - speedIncrease);
// Clear command and generate new one
currentCommand = '';
commandTxt.setText('');
LK.setTimeout(generateCommand, 500);
} else {
// Wrong answer - continue game
LK.getSound('wrong').play();
// Just generate a new command instead of game over
currentCommand = '';
commandTxt.setText('');
LK.setTimeout(generateCommand, 500);
}
}
function gameOver() {
isGameActive = false;
LK.clearTimeout(commandTimeout);
currentCommand = '';
commandTxt.setText('');
// Flash screen red
LK.effects.flashScreen(0xff0000, 1000);
// Show game over after flash
LK.setTimeout(function () {
LK.showGameOver();
}, 500);
}
function startGame() {
isGameActive = true;
LK.setScore(0);
scoreTxt.setText('0');
gameSpeed = 2000;
passedArrowsCount = 0;
passedCirclesCount = 0;
// Start first command after a brief delay
LK.setTimeout(generateCommand, 1000);
}
// Keyboard event handler
game.keydown = function (keyCode) {
if (keyCode === 55) {
// Key '7' - Destroy up-left arrows
for (var i = movingArrows.length - 1; i >= 0; i--) {
var arrow = movingArrows[i];
if (arrow.direction === 'up-left') {
arrow.destroy();
movingArrows.splice(i, 1);
}
}
} else if (keyCode === 57) {
// Key '9' - Destroy up-right arrows
for (var i = movingArrows.length - 1; i >= 0; i--) {
var arrow = movingArrows[i];
if (arrow.direction === 'up-right') {
arrow.destroy();
movingArrows.splice(i, 1);
}
}
} else if (keyCode === 49) {
// Key '1' - Destroy down-left arrows
for (var i = movingArrows.length - 1; i >= 0; i--) {
var arrow = movingArrows[i];
if (arrow.direction === 'down-left') {
arrow.destroy();
movingArrows.splice(i, 1);
}
}
} else if (keyCode === 51) {
// Key '3' - Destroy down-right arrows
for (var i = movingArrows.length - 1; i >= 0; i--) {
var arrow = movingArrows[i];
if (arrow.direction === 'down-right') {
arrow.destroy();
movingArrows.splice(i, 1);
}
}
} else if (keyCode === 53) {
// Key '5' - Destroy all moving circles
for (var i = movingCircles.length - 1; i >= 0; i--) {
var circle = movingCircles[i];
circle.destroy();
movingCircles.splice(i, 1);
}
} else if (keyCode === 81) {
// Key 'Q' - Triple the speed of all moving arrows and circles
for (var i = 0; i < movingArrows.length; i++) {
movingArrows[i].speed *= 3;
}
for (var j = 0; j < movingCircles.length; j++) {
movingCircles[j].speed *= 3;
}
}
};
// Right-click event handler
game.rightdown = function (x, y, obj) {
// Increase speed of all moving arrows
for (var i = 0; i < movingArrows.length; i++) {
movingArrows[i].speed += 1;
}
// Increase speed of all moving circles
for (var j = 0; j < movingCircles.length; j++) {
movingCircles[j].speed += 1;
}
// Increase overall game speed (reduce command timeout)
gameSpeed = Math.max(minSpeed, gameSpeed - speedIncrease);
};
// Multiply speed of all moving arrows and circles by 5
for (var i = 0; i < movingArrows.length; i++) {
movingArrows[i].speed *= 5;
}
for (var j = 0; j < movingCircles.length; j++) {
movingCircles[j].speed *= 5;
}
// Start the game
startGame();
game.update = function () {
// Spawn moving arrows periodically
if (LK.ticks % 120 === 0) {
var directions = ['up-right', 'up-left', 'down-right', 'down-left'];
var randomDirection = directions[Math.floor(Math.random() * directions.length)];
var movingArrow = new MovingArrow(randomDirection);
// Position at bottom of screen, aligned with corresponding static arrow
var arrowX = 2048 / 2;
if (randomDirection === 'up-right') arrowX = 2048 / 2 + 400;else if (randomDirection === 'up-left') arrowX = 2048 / 2 + 150;else if (randomDirection === 'down-right') arrowX = 2048 / 2 - 150;else if (randomDirection === 'down-left') arrowX = 2048 / 2 - 400;
movingArrow.x = arrowX;
movingArrow.y = 2732; // Start at bottom of screen
movingArrows.push(movingArrow);
game.addChild(movingArrow);
}
// Spawn moving circles periodically
if (LK.ticks % 180 === 0) {
var movingCircle = new MovingCircle();
movingCircle.x = 2048 / 2; // Center position like static circle
movingCircle.y = 2732; // Start at bottom of screen
movingCircles.push(movingCircle);
game.addChild(movingCircle);
}
// Update moving arrows
for (var i = movingArrows.length - 1; i >= 0; i--) {
var arrow = movingArrows[i];
if (arrow.lastY === undefined) arrow.lastY = arrow.y;
// Check if arrow passed the static arrows (y position 300)
if (arrow.lastY >= 300 && arrow.y < 300) {
passedArrowsCount++;
if (passedArrowsCount >= 10) {
gameOver();
return;
}
}
arrow.lastY = arrow.y;
}
// Update moving circles
for (var j = movingCircles.length - 1; j >= 0; j--) {
var circle = movingCircles[j];
if (circle.lastY === undefined) circle.lastY = circle.y;
// Check if circle passed the static circle (y position 300)
if (circle.lastY >= 300 && circle.y < 300) {
passedCirclesCount++;
if (passedCirclesCount >= 10) {
gameOver();
return;
}
}
circle.lastY = circle.y;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -87,9 +87,9 @@
anchorX: 0.5,
anchorY: 0.5
});
self.direction = direction;
- self.speed = 3;
+ self.speed = 15;
self.targetY = 300; // Same height as static arrows
self.lastY = undefined;
// Set rotation based on direction
if (direction === 'up-right') {
@@ -124,9 +124,9 @@
var circleGraphics = self.attachAsset('circle', {
anchorX: 0.5,
anchorY: 0.5
});
- self.speed = 3;
+ self.speed = 15;
self.targetY = 300; // Same height as static circle
self.lastY = undefined;
self.update = function () {
// Track last Y position
@@ -373,8 +373,15 @@
}
// Increase overall game speed (reduce command timeout)
gameSpeed = Math.max(minSpeed, gameSpeed - speedIncrease);
};
+// Multiply speed of all moving arrows and circles by 5
+for (var i = 0; i < movingArrows.length; i++) {
+ movingArrows[i].speed *= 5;
+}
+for (var j = 0; j < movingCircles.length; j++) {
+ movingCircles[j].speed *= 5;
+}
// Start the game
startGame();
game.update = function () {
// Spawn moving arrows periodically