User prompt
haz que el fondo, no sea estatico ai no que se mueva hacia la izquierda ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
usa la imagen "fondo" para decorar... el fondo, es muy soso sin nada
User prompt
solo aparece un obstaculo, seguramente el inferior
User prompt
note que los obstaculos solo cubre el borde del agujero, pero el resto esta vacio dejando pasar, eso hay que arreglarlo
Code edit (1 edits merged)
Please save this source code
User prompt
Animatronic Chicken Flight
Initial prompt
quiero un juego donde eres un pollo animatronico que tiene que volar y pasar entre dos obstaculos, un arriba y otro abakp, dejando un pequeño espacio
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Chicken = Container.expand(function () {
var self = Container.call(this);
var chickenGraphics = self.attachAsset('chicken', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocity = 0;
self.gravity = 0.5;
self.flapPower = -12;
self.rotation = 0;
self.flap = function () {
self.velocity = self.flapPower;
LK.getSound('flap').play();
// Animate flap with rotation
tween(self, {
rotation: -0.3
}, {
duration: 100
});
tween(self, {
rotation: 0
}, {
duration: 200
});
};
self.update = function () {
// Apply gravity
self.velocity += self.gravity;
// Move chicken
self.y += self.velocity;
// Rotate based on velocity for realistic movement
if (self.velocity > 0) {
self.rotation = Math.min(self.velocity * 0.05, 0.5);
} else {
self.rotation = Math.max(self.velocity * 0.05, -0.5);
}
// Check screen boundaries
if (self.y < 0 || self.y > 2732) {
gameOver();
}
};
return self;
});
var Obstacle = Container.expand(function () {
var self = Container.call(this);
self.gapSize = 300;
self.gapY = 2732 / 2;
self.speed = -4;
self.scored = false;
// Create top obstacle
self.topObstacle = self.attachAsset('topObstacle', {
anchorX: 0.5,
anchorY: 1
});
// Create bottom obstacle
self.bottomObstacle = self.attachAsset('bottomObstacle', {
anchorX: 0.5,
anchorY: 0
});
self.setGap = function (gapY, gapSize) {
self.gapY = gapY;
self.gapSize = gapSize;
// Calculate heights to cover full screen areas
var topHeight = gapY - gapSize / 2;
var bottomHeight = 2732 - (gapY + gapSize / 2);
// Resize obstacles to cover full areas
self.topObstacle.height = topHeight;
self.bottomObstacle.height = bottomHeight;
// Position obstacles - top obstacle at bottom of its area, bottom at gap start
self.topObstacle.y = gapY - gapSize / 2;
self.bottomObstacle.y = gapY + gapSize / 2;
};
self.update = function () {
self.x += self.speed;
// Check if obstacle passed chicken and award score
if (!self.scored && self.x < chicken.x) {
self.scored = true;
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
LK.getSound('score').play();
}
// Remove obstacle when off screen
if (self.x < -100) {
self.destroy();
for (var i = obstacles.length - 1; i >= 0; i--) {
if (obstacles[i] === self) {
obstacles.splice(i, 1);
break;
}
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var chicken;
var obstacles = [];
var gameStarted = false;
var obstacleTimer = 0;
var obstacleSpacing = 180; // Frames between obstacles
// Create score display
var scoreTxt = new Text2('0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create scrolling backgrounds
var background1 = game.attachAsset('fondo', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 20.48,
// Scale to cover full width (2048/100)
scaleY: 27.32,
// Scale to cover full height (2732/100)
x: 2048 / 2,
y: 2732 / 2
});
var background2 = game.attachAsset('fondo', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 20.48,
scaleY: 27.32,
x: 2048 / 2 + 2048,
// Position second background to the right
y: 2732 / 2
});
// Create chicken
chicken = game.addChild(new Chicken());
chicken.x = 400;
chicken.y = 2732 / 2;
// Create instructions text
var instructionsTxt = new Text2('TAP TO START', {
size: 60,
fill: 0xFFFFFF
});
instructionsTxt.anchor.set(0.5, 0.5);
instructionsTxt.x = 2048 / 2;
instructionsTxt.y = 2732 / 2 - 200;
game.addChild(instructionsTxt);
function gameOver() {
LK.showGameOver();
}
function startGame() {
if (!gameStarted) {
gameStarted = true;
game.removeChild(instructionsTxt);
}
}
function createObstacle() {
var obstacle = new Obstacle();
obstacle.x = 2048 + 60;
// Random gap position, keeping it reasonable
var minGapY = 400;
var maxGapY = 2732 - 400;
var gapY = minGapY + Math.random() * (maxGapY - minGapY);
// Gap size gets smaller as score increases
var baseGapSize = 300;
var gapSize = Math.max(200, baseGapSize - LK.getScore() * 5);
obstacle.setGap(gapY, gapSize);
obstacles.push(obstacle);
game.addChild(obstacle);
}
// Input handling
game.down = function (x, y, obj) {
if (!gameStarted) {
startGame();
}
chicken.flap();
};
// Main game loop
game.update = function () {
// Scroll backgrounds continuously
var scrollSpeed = -2;
background1.x += scrollSpeed;
background2.x += scrollSpeed;
// Reset background positions when they go off screen
if (background1.x <= -2048 / 2) {
background1.x = background2.x + 2048;
}
if (background2.x <= -2048 / 2) {
background2.x = background1.x + 2048;
}
if (!gameStarted) {
return;
}
// Create obstacles
obstacleTimer++;
if (obstacleTimer >= obstacleSpacing) {
createObstacle();
obstacleTimer = 0;
// Increase difficulty by reducing spacing
if (obstacleSpacing > 120) {
obstacleSpacing = Math.max(120, obstacleSpacing - 1);
}
}
// Check collisions
for (var i = 0; i < obstacles.length; i++) {
var obstacle = obstacles[i];
// Check collision with top obstacle
if (chicken.intersects(obstacle.topObstacle)) {
gameOver();
return;
}
// Check collision with bottom obstacle
if (chicken.intersects(obstacle.bottomObstacle)) {
gameOver();
return;
}
}
}; /****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Chicken = Container.expand(function () {
var self = Container.call(this);
var chickenGraphics = self.attachAsset('chicken', {
anchorX: 0.5,
anchorY: 0.5
});
self.velocity = 0;
self.gravity = 0.5;
self.flapPower = -12;
self.rotation = 0;
self.flap = function () {
self.velocity = self.flapPower;
LK.getSound('flap').play();
// Animate flap with rotation
tween(self, {
rotation: -0.3
}, {
duration: 100
});
tween(self, {
rotation: 0
}, {
duration: 200
});
};
self.update = function () {
// Apply gravity
self.velocity += self.gravity;
// Move chicken
self.y += self.velocity;
// Rotate based on velocity for realistic movement
if (self.velocity > 0) {
self.rotation = Math.min(self.velocity * 0.05, 0.5);
} else {
self.rotation = Math.max(self.velocity * 0.05, -0.5);
}
// Check screen boundaries
if (self.y < 0 || self.y > 2732) {
gameOver();
}
};
return self;
});
var Obstacle = Container.expand(function () {
var self = Container.call(this);
self.gapSize = 300;
self.gapY = 2732 / 2;
self.speed = -4;
self.scored = false;
// Create top obstacle
self.topObstacle = self.attachAsset('topObstacle', {
anchorX: 0.5,
anchorY: 1
});
// Create bottom obstacle
self.bottomObstacle = self.attachAsset('bottomObstacle', {
anchorX: 0.5,
anchorY: 0
});
self.setGap = function (gapY, gapSize) {
self.gapY = gapY;
self.gapSize = gapSize;
// Calculate heights to cover full screen areas
var topHeight = gapY - gapSize / 2;
var bottomHeight = 2732 - (gapY + gapSize / 2);
// Resize obstacles to cover full areas
self.topObstacle.height = topHeight;
self.bottomObstacle.height = bottomHeight;
// Position obstacles - top obstacle at bottom of its area, bottom at gap start
self.topObstacle.y = gapY - gapSize / 2;
self.bottomObstacle.y = gapY + gapSize / 2;
};
self.update = function () {
self.x += self.speed;
// Check if obstacle passed chicken and award score
if (!self.scored && self.x < chicken.x) {
self.scored = true;
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
LK.getSound('score').play();
}
// Remove obstacle when off screen
if (self.x < -100) {
self.destroy();
for (var i = obstacles.length - 1; i >= 0; i--) {
if (obstacles[i] === self) {
obstacles.splice(i, 1);
break;
}
}
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var chicken;
var obstacles = [];
var gameStarted = false;
var obstacleTimer = 0;
var obstacleSpacing = 180; // Frames between obstacles
// Create score display
var scoreTxt = new Text2('0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Create scrolling backgrounds
var background1 = game.attachAsset('fondo', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 20.48,
// Scale to cover full width (2048/100)
scaleY: 27.32,
// Scale to cover full height (2732/100)
x: 2048 / 2,
y: 2732 / 2
});
var background2 = game.attachAsset('fondo', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 20.48,
scaleY: 27.32,
x: 2048 / 2 + 2048,
// Position second background to the right
y: 2732 / 2
});
// Create chicken
chicken = game.addChild(new Chicken());
chicken.x = 400;
chicken.y = 2732 / 2;
// Create instructions text
var instructionsTxt = new Text2('TAP TO START', {
size: 60,
fill: 0xFFFFFF
});
instructionsTxt.anchor.set(0.5, 0.5);
instructionsTxt.x = 2048 / 2;
instructionsTxt.y = 2732 / 2 - 200;
game.addChild(instructionsTxt);
function gameOver() {
LK.showGameOver();
}
function startGame() {
if (!gameStarted) {
gameStarted = true;
game.removeChild(instructionsTxt);
}
}
function createObstacle() {
var obstacle = new Obstacle();
obstacle.x = 2048 + 60;
// Random gap position, keeping it reasonable
var minGapY = 400;
var maxGapY = 2732 - 400;
var gapY = minGapY + Math.random() * (maxGapY - minGapY);
// Gap size gets smaller as score increases
var baseGapSize = 300;
var gapSize = Math.max(200, baseGapSize - LK.getScore() * 5);
obstacle.setGap(gapY, gapSize);
obstacles.push(obstacle);
game.addChild(obstacle);
}
// Input handling
game.down = function (x, y, obj) {
if (!gameStarted) {
startGame();
}
chicken.flap();
};
// Main game loop
game.update = function () {
// Scroll backgrounds continuously
var scrollSpeed = -2;
background1.x += scrollSpeed;
background2.x += scrollSpeed;
// Reset background positions when they go off screen
if (background1.x <= -2048 / 2) {
background1.x = background2.x + 2048;
}
if (background2.x <= -2048 / 2) {
background2.x = background1.x + 2048;
}
if (!gameStarted) {
return;
}
// Create obstacles
obstacleTimer++;
if (obstacleTimer >= obstacleSpacing) {
createObstacle();
obstacleTimer = 0;
// Increase difficulty by reducing spacing
if (obstacleSpacing > 120) {
obstacleSpacing = Math.max(120, obstacleSpacing - 1);
}
}
// Check collisions
for (var i = 0; i < obstacles.length; i++) {
var obstacle = obstacles[i];
// Check collision with top obstacle
if (chicken.intersects(obstacle.topObstacle)) {
gameOver();
return;
}
// Check collision with bottom obstacle
if (chicken.intersects(obstacle.bottomObstacle)) {
gameOver();
return;
}
}
};
Fullscreen modern App Store landscape banner, 16:9, high definition, for a game titled "Animatronic Chicken Flight" and with the description "Navigate an animatronic chicken through vertical obstacle courses by tapping to flap and fly through narrow gaps between top and bottom barriers.". No text on banner!
una tuberia en vertical, una sola sin ningua otra y sin y en otra direccion. In-Game asset. 2d. High contrast. No shadows
fondo de una ciudad a la distancia. In-Game asset. 2d. High contrast. No shadows