User prompt
Si, si, se pueden elegir las skins, pero no cambia el diseño del personaje, quiero que cuando toques un botón de diferente skin, cambie el diseño del personaje, y también que los niveles sean más variados, porque del 3 para adelante es solo subir, quiero que sea todavía más variado, que haya, no sé, otra cosa más.
User prompt
Quiero que donde puedas elegir la skin, que la puedas cambiar, o sea que agregues otras skins y también que agregues imágenes para la vida y para el contenedor de monedas.
User prompt
Quiero que agregues también un contador de monedas y uno que tengas tres vidas también, uno que tengas tres corazones de vida por si te golpean los enemigos.
User prompt
acomoda a los enemigos, porque hay una parte de las plataformas que es imposible pasar y así que las monedas también acomodarlas porque tampoco algunas se pueden agarrar.
User prompt
niveles más largos todavía, o sea no digo más complicados, niveles más complicados más largos no más complicados y que se arregle porque el personaje ya no salta, se arruinó el salto del personaje
User prompt
Quiero que la cámara esté más cerca, haya plataformas más grandes y otras más chicas, que los enemigos sean más grandes porque no se ven.
User prompt
La cámara todavía más cerca, tiene que estar más cerca del personaje, no se puede ver tantas plataformas, tiene que estar de mucho más cerca.
User prompt
Mejorar los niveles porque son muy repetitivos, es solo ir saltando de arriba a arriba y después hacer que bajen las plataformas y que suban, que haya plataformas que se muevan para arriba y para abajo también. ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Los botones no se mueven con la pantalla, con la cámara, los botones se quedan atrás de la cámara, tenés que arreglar eso. Y te hace que el fondo también se duplique para que no se salga del juego.
User prompt
Que la cámara esté de más cerca porque no se ve nada, y agrandá los botones porque son complicados de tocar también.
User prompt
Necesito que los niveles sean más largos, con más plataformas, pero que sean todavía más complicados, y que aparezcan más enemigos, y...
User prompt
Me gustaría que cuando pierdas el nivel, si ponés jugar de nuevo, te vuelves a ese mismo nivel y no tenés que volver a la pantalla de inicio.
User prompt
acercar más la cámara porque se ve demasiado lejos el personaje, hace que el nivel sea diferente porque es todo en escalerita y no tiene que ser todo en escalerita, o sea que las plataformas estén yendo a otros lados y haya diferentes cosas, que los bichos aparezcan...
User prompt
necesito que ahora sea un poco más complicado, o sea, saca los pinchos que te había dicho que pongas porque quedan horribles, necesito que hagas un fondo, o sea, que pongas un fondo
User prompt
Please fix the bug: 'storage.getItem is not a function' in or related to this line: 'var selectedSkin = storage.getItem('selectedSkin') || 0xFFFFFF;' Line Number: 451 ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
agrega todavía más niveles y quiero que los botones, o sea, te puedas ver para atrás, para adelante y haya un botón por separado para saltar, que esté todo perfecto y más otro tipo de enemigos, o si no, unos pinchos, unos pinchos que se pongan en las plataformas para que eso complique más
User prompt
También me gustaría una interfaz para empezar la partida, otra interfaz para elegir qué nivel querés jugar y poder cambiar de skin o botones, también botones, que se vean los botones, porque no se ven los botones, no sé dónde tocar.
User prompt
necesito que lo hagas un poco más fácil y que haya plataformas más juntas que los mosquitos sean un poquito más fáciles de esquivar o sea que los enemigos sean más fáciles de esquivar y más niveles más niveles
Code edit (1 edits merged)
Please save this source code
User prompt
Platform Coin Rush
Initial prompt
Bueno, quiero que sea un juego que sea tipo plataformas, donde tengas que ir saltando y esquivando cosas, que haya tipo pisos que se rompen, con bichos que van de un lado para el otro para que se te complique para pasar y ese estilo de cosas, y tengas que ir agarrando monedas y llegar al final del nivel.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var BreakablePlatform = Container.expand(function () {
var self = Container.call(this);
var platformGraphics = self.attachAsset('breakablePlatform', {
anchorX: 0.5,
anchorY: 0.5
});
self.solid = true;
self.breakTimer = 0;
self.maxBreakTime = 120; // 2 seconds at 60fps
self.playerOnPlatform = false;
self.lastPlayerOnPlatform = false;
self.update = function () {
if (self.playerOnPlatform && self.solid) {
self.breakTimer++;
// Flash red as it's about to break
if (self.breakTimer > self.maxBreakTime * 0.7) {
platformGraphics.tint = self.breakTimer % 10 < 5 ? 0xFF0000 : 0xFFFFFF;
}
if (self.breakTimer >= self.maxBreakTime) {
self.solid = false;
platformGraphics.alpha = 0.3;
LK.getSound('platformBreak').play();
}
}
self.lastPlayerOnPlatform = self.playerOnPlatform;
self.playerOnPlatform = false;
};
return self;
});
var Coin = Container.expand(function () {
var self = Container.call(this);
var coinGraphics = self.attachAsset('coin', {
anchorX: 0.5,
anchorY: 0.5
});
self.collected = false;
self.bobOffset = 0;
self.initialY = 0;
self.update = function () {
if (!self.collected) {
self.bobOffset += 0.1;
coinGraphics.y = Math.sin(self.bobOffset) * 5;
coinGraphics.rotation += 0.05;
}
};
return self;
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 1.0
});
self.speed = 2;
self.direction = 1;
self.patrolDistance = 150;
self.startX = 0;
self.update = function () {
self.x += self.speed * self.direction;
// Turn around at patrol limits
if (Math.abs(self.x - self.startX) > self.patrolDistance) {
self.direction *= -1;
}
};
return self;
});
var FinishLine = Container.expand(function () {
var self = Container.call(this);
var finishGraphics = self.attachAsset('finishLine', {
anchorX: 0.5,
anchorY: 1.0
});
return self;
});
var Platform = Container.expand(function () {
var self = Container.call(this);
var platformGraphics = self.attachAsset('platform', {
anchorX: 0.5,
anchorY: 0.5
});
self.solid = true;
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 1.0
});
self.velocityX = 0;
self.velocityY = 0;
self.speed = 8;
self.jumpPower = 18;
self.gravity = 0.8;
self.isGrounded = false;
self.groundPlatform = null;
self.update = function () {
// Apply gravity
self.velocityY += self.gravity;
// Apply movement
self.x += self.velocityX;
self.y += self.velocityY;
// Friction when grounded
if (self.isGrounded) {
self.velocityX *= 0.8;
}
// Check if fell off screen
if (self.y > 2732 + 100) {
LK.showGameOver();
}
};
self.jump = function () {
if (self.isGrounded) {
self.velocityY = -self.jumpPower;
self.isGrounded = false;
self.groundPlatform = null;
LK.getSound('jump').play();
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var player;
var platforms = [];
var breakablePlatforms = [];
var enemies = [];
var coins = [];
var finishLine;
// Camera offset
var cameraX = 0;
// Controls
var moveLeft = false;
var moveRight = false;
// UI
var scoreTxt = new Text2('Coins: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0, 0);
LK.gui.topLeft.addChild(scoreTxt);
// Initialize level
function createLevel() {
// Create player
player = game.addChild(new Player());
player.x = 200;
player.y = 2200;
// Create platforms
var platformData = [{
x: 200,
y: 2300,
type: 'platform'
}, {
x: 500,
y: 2100,
type: 'breakable'
}, {
x: 800,
y: 1900,
type: 'platform'
}, {
x: 1200,
y: 1700,
type: 'breakable'
}, {
x: 1600,
y: 1500,
type: 'platform'
}, {
x: 2000,
y: 1300,
type: 'breakable'
}, {
x: 2400,
y: 1100,
type: 'platform'
}, {
x: 2800,
y: 900,
type: 'breakable'
}, {
x: 3200,
y: 700,
type: 'platform'
}, {
x: 3600,
y: 500,
type: 'platform'
}];
platformData.forEach(function (data) {
if (data.type === 'platform') {
var platform = game.addChild(new Platform());
platform.x = data.x;
platform.y = data.y;
platforms.push(platform);
} else {
var breakablePlatform = game.addChild(new BreakablePlatform());
breakablePlatform.x = data.x;
breakablePlatform.y = data.y;
breakablePlatforms.push(breakablePlatform);
}
});
// Create enemies
var enemyData = [{
x: 800,
y: 1840
}, {
x: 1600,
y: 1440
}, {
x: 2800,
y: 840
}, {
x: 3600,
y: 440
}];
enemyData.forEach(function (data) {
var enemy = game.addChild(new Enemy());
enemy.x = data.x;
enemy.y = data.y;
enemy.startX = data.x;
enemies.push(enemy);
});
// Create coins
var coinData = [{
x: 350,
y: 2050
}, {
x: 650,
y: 1850
}, {
x: 1050,
y: 1650
}, {
x: 1450,
y: 1450
}, {
x: 1850,
y: 1250
}, {
x: 2250,
y: 1050
}, {
x: 2650,
y: 850
}, {
x: 3050,
y: 650
}, {
x: 3450,
y: 450
}];
coinData.forEach(function (data) {
var coin = game.addChild(new Coin());
coin.x = data.x;
coin.y = data.y;
coin.initialY = data.y;
coins.push(coin);
});
// Create finish line
finishLine = game.addChild(new FinishLine());
finishLine.x = 3800;
finishLine.y = 500;
}
// Collision detection
function checkPlatformCollisions() {
var allPlatforms = platforms.concat(breakablePlatforms.filter(function (p) {
return p.solid;
}));
player.isGrounded = false;
allPlatforms.forEach(function (platform) {
if (player.x > platform.x - 100 && player.x < platform.x + 100 && player.y > platform.y - 30 && player.y < platform.y + 10 && player.velocityY >= 0) {
player.y = platform.y - 20;
player.velocityY = 0;
player.isGrounded = true;
player.groundPlatform = platform;
// Mark breakable platform as having player on it
if (platform.breakTimer !== undefined) {
platform.playerOnPlatform = true;
}
}
});
}
function checkEnemyCollisions() {
enemies.forEach(function (enemy) {
if (player.intersects(enemy)) {
LK.effects.flashScreen(0xFF0000, 1000);
LK.showGameOver();
}
});
}
function checkCoinCollisions() {
for (var i = coins.length - 1; i >= 0; i--) {
var coin = coins[i];
if (!coin.collected && player.intersects(coin)) {
coin.collected = true;
coin.alpha = 0;
LK.setScore(LK.getScore() + 1);
scoreTxt.setText('Coins: ' + LK.getScore());
LK.getSound('coinCollect').play();
coins.splice(i, 1);
coin.destroy();
}
}
}
function checkFinishLine() {
if (player.intersects(finishLine)) {
LK.showYouWin();
}
}
function updateCamera() {
// Follow player with camera
var targetCameraX = player.x - 1024;
cameraX += (targetCameraX - cameraX) * 0.1;
// Limit camera bounds
if (cameraX < 0) cameraX = 0;
if (cameraX > 2800) cameraX = 2800;
game.x = -cameraX;
}
// Touch controls
game.down = function (x, y, obj) {
// Jump on any tap
player.jump();
// Move left/right based on screen side
if (x < 1024) {
moveLeft = true;
moveRight = false;
} else {
moveLeft = false;
moveRight = true;
}
};
game.up = function (x, y, obj) {
moveLeft = false;
moveRight = false;
};
game.update = function () {
// Handle movement input
if (moveLeft) {
player.velocityX = Math.max(player.velocityX - 1, -player.speed);
}
if (moveRight) {
player.velocityX = Math.min(player.velocityX + 1, player.speed);
}
// Check collisions
checkPlatformCollisions();
checkEnemyCollisions();
checkCoinCollisions();
checkFinishLine();
// Update camera
updateCamera();
};
// Initialize the level
createLevel(); ===================================================================
--- original.js
+++ change.js
@@ -1,6 +1,371 @@
-/****
+/****
+* Plugins
+****/
+var tween = LK.import("@upit/tween.v1");
+
+/****
+* Classes
+****/
+var BreakablePlatform = Container.expand(function () {
+ var self = Container.call(this);
+ var platformGraphics = self.attachAsset('breakablePlatform', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.solid = true;
+ self.breakTimer = 0;
+ self.maxBreakTime = 120; // 2 seconds at 60fps
+ self.playerOnPlatform = false;
+ self.lastPlayerOnPlatform = false;
+ self.update = function () {
+ if (self.playerOnPlatform && self.solid) {
+ self.breakTimer++;
+ // Flash red as it's about to break
+ if (self.breakTimer > self.maxBreakTime * 0.7) {
+ platformGraphics.tint = self.breakTimer % 10 < 5 ? 0xFF0000 : 0xFFFFFF;
+ }
+ if (self.breakTimer >= self.maxBreakTime) {
+ self.solid = false;
+ platformGraphics.alpha = 0.3;
+ LK.getSound('platformBreak').play();
+ }
+ }
+ self.lastPlayerOnPlatform = self.playerOnPlatform;
+ self.playerOnPlatform = false;
+ };
+ return self;
+});
+var Coin = Container.expand(function () {
+ var self = Container.call(this);
+ var coinGraphics = self.attachAsset('coin', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.collected = false;
+ self.bobOffset = 0;
+ self.initialY = 0;
+ self.update = function () {
+ if (!self.collected) {
+ self.bobOffset += 0.1;
+ coinGraphics.y = Math.sin(self.bobOffset) * 5;
+ coinGraphics.rotation += 0.05;
+ }
+ };
+ return self;
+});
+var Enemy = Container.expand(function () {
+ var self = Container.call(this);
+ var enemyGraphics = self.attachAsset('enemy', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ self.speed = 2;
+ self.direction = 1;
+ self.patrolDistance = 150;
+ self.startX = 0;
+ self.update = function () {
+ self.x += self.speed * self.direction;
+ // Turn around at patrol limits
+ if (Math.abs(self.x - self.startX) > self.patrolDistance) {
+ self.direction *= -1;
+ }
+ };
+ return self;
+});
+var FinishLine = Container.expand(function () {
+ var self = Container.call(this);
+ var finishGraphics = self.attachAsset('finishLine', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ return self;
+});
+var Platform = Container.expand(function () {
+ var self = Container.call(this);
+ var platformGraphics = self.attachAsset('platform', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.solid = true;
+ return self;
+});
+var Player = Container.expand(function () {
+ var self = Container.call(this);
+ var playerGraphics = self.attachAsset('player', {
+ anchorX: 0.5,
+ anchorY: 1.0
+ });
+ self.velocityX = 0;
+ self.velocityY = 0;
+ self.speed = 8;
+ self.jumpPower = 18;
+ self.gravity = 0.8;
+ self.isGrounded = false;
+ self.groundPlatform = null;
+ self.update = function () {
+ // Apply gravity
+ self.velocityY += self.gravity;
+ // Apply movement
+ self.x += self.velocityX;
+ self.y += self.velocityY;
+ // Friction when grounded
+ if (self.isGrounded) {
+ self.velocityX *= 0.8;
+ }
+ // Check if fell off screen
+ if (self.y > 2732 + 100) {
+ LK.showGameOver();
+ }
+ };
+ self.jump = function () {
+ if (self.isGrounded) {
+ self.velocityY = -self.jumpPower;
+ self.isGrounded = false;
+ self.groundPlatform = null;
+ LK.getSound('jump').play();
+ }
+ };
+ return self;
+});
+
+/****
* Initialize Game
-****/
+****/
var game = new LK.Game({
- backgroundColor: 0x000000
-});
\ No newline at end of file
+ backgroundColor: 0x87CEEB
+});
+
+/****
+* Game Code
+****/
+var player;
+var platforms = [];
+var breakablePlatforms = [];
+var enemies = [];
+var coins = [];
+var finishLine;
+// Camera offset
+var cameraX = 0;
+// Controls
+var moveLeft = false;
+var moveRight = false;
+// UI
+var scoreTxt = new Text2('Coins: 0', {
+ size: 80,
+ fill: 0xFFFFFF
+});
+scoreTxt.anchor.set(0, 0);
+LK.gui.topLeft.addChild(scoreTxt);
+// Initialize level
+function createLevel() {
+ // Create player
+ player = game.addChild(new Player());
+ player.x = 200;
+ player.y = 2200;
+ // Create platforms
+ var platformData = [{
+ x: 200,
+ y: 2300,
+ type: 'platform'
+ }, {
+ x: 500,
+ y: 2100,
+ type: 'breakable'
+ }, {
+ x: 800,
+ y: 1900,
+ type: 'platform'
+ }, {
+ x: 1200,
+ y: 1700,
+ type: 'breakable'
+ }, {
+ x: 1600,
+ y: 1500,
+ type: 'platform'
+ }, {
+ x: 2000,
+ y: 1300,
+ type: 'breakable'
+ }, {
+ x: 2400,
+ y: 1100,
+ type: 'platform'
+ }, {
+ x: 2800,
+ y: 900,
+ type: 'breakable'
+ }, {
+ x: 3200,
+ y: 700,
+ type: 'platform'
+ }, {
+ x: 3600,
+ y: 500,
+ type: 'platform'
+ }];
+ platformData.forEach(function (data) {
+ if (data.type === 'platform') {
+ var platform = game.addChild(new Platform());
+ platform.x = data.x;
+ platform.y = data.y;
+ platforms.push(platform);
+ } else {
+ var breakablePlatform = game.addChild(new BreakablePlatform());
+ breakablePlatform.x = data.x;
+ breakablePlatform.y = data.y;
+ breakablePlatforms.push(breakablePlatform);
+ }
+ });
+ // Create enemies
+ var enemyData = [{
+ x: 800,
+ y: 1840
+ }, {
+ x: 1600,
+ y: 1440
+ }, {
+ x: 2800,
+ y: 840
+ }, {
+ x: 3600,
+ y: 440
+ }];
+ enemyData.forEach(function (data) {
+ var enemy = game.addChild(new Enemy());
+ enemy.x = data.x;
+ enemy.y = data.y;
+ enemy.startX = data.x;
+ enemies.push(enemy);
+ });
+ // Create coins
+ var coinData = [{
+ x: 350,
+ y: 2050
+ }, {
+ x: 650,
+ y: 1850
+ }, {
+ x: 1050,
+ y: 1650
+ }, {
+ x: 1450,
+ y: 1450
+ }, {
+ x: 1850,
+ y: 1250
+ }, {
+ x: 2250,
+ y: 1050
+ }, {
+ x: 2650,
+ y: 850
+ }, {
+ x: 3050,
+ y: 650
+ }, {
+ x: 3450,
+ y: 450
+ }];
+ coinData.forEach(function (data) {
+ var coin = game.addChild(new Coin());
+ coin.x = data.x;
+ coin.y = data.y;
+ coin.initialY = data.y;
+ coins.push(coin);
+ });
+ // Create finish line
+ finishLine = game.addChild(new FinishLine());
+ finishLine.x = 3800;
+ finishLine.y = 500;
+}
+// Collision detection
+function checkPlatformCollisions() {
+ var allPlatforms = platforms.concat(breakablePlatforms.filter(function (p) {
+ return p.solid;
+ }));
+ player.isGrounded = false;
+ allPlatforms.forEach(function (platform) {
+ if (player.x > platform.x - 100 && player.x < platform.x + 100 && player.y > platform.y - 30 && player.y < platform.y + 10 && player.velocityY >= 0) {
+ player.y = platform.y - 20;
+ player.velocityY = 0;
+ player.isGrounded = true;
+ player.groundPlatform = platform;
+ // Mark breakable platform as having player on it
+ if (platform.breakTimer !== undefined) {
+ platform.playerOnPlatform = true;
+ }
+ }
+ });
+}
+function checkEnemyCollisions() {
+ enemies.forEach(function (enemy) {
+ if (player.intersects(enemy)) {
+ LK.effects.flashScreen(0xFF0000, 1000);
+ LK.showGameOver();
+ }
+ });
+}
+function checkCoinCollisions() {
+ for (var i = coins.length - 1; i >= 0; i--) {
+ var coin = coins[i];
+ if (!coin.collected && player.intersects(coin)) {
+ coin.collected = true;
+ coin.alpha = 0;
+ LK.setScore(LK.getScore() + 1);
+ scoreTxt.setText('Coins: ' + LK.getScore());
+ LK.getSound('coinCollect').play();
+ coins.splice(i, 1);
+ coin.destroy();
+ }
+ }
+}
+function checkFinishLine() {
+ if (player.intersects(finishLine)) {
+ LK.showYouWin();
+ }
+}
+function updateCamera() {
+ // Follow player with camera
+ var targetCameraX = player.x - 1024;
+ cameraX += (targetCameraX - cameraX) * 0.1;
+ // Limit camera bounds
+ if (cameraX < 0) cameraX = 0;
+ if (cameraX > 2800) cameraX = 2800;
+ game.x = -cameraX;
+}
+// Touch controls
+game.down = function (x, y, obj) {
+ // Jump on any tap
+ player.jump();
+ // Move left/right based on screen side
+ if (x < 1024) {
+ moveLeft = true;
+ moveRight = false;
+ } else {
+ moveLeft = false;
+ moveRight = true;
+ }
+};
+game.up = function (x, y, obj) {
+ moveLeft = false;
+ moveRight = false;
+};
+game.update = function () {
+ // Handle movement input
+ if (moveLeft) {
+ player.velocityX = Math.max(player.velocityX - 1, -player.speed);
+ }
+ if (moveRight) {
+ player.velocityX = Math.min(player.velocityX + 1, player.speed);
+ }
+ // Check collisions
+ checkPlatformCollisions();
+ checkEnemyCollisions();
+ checkCoinCollisions();
+ checkFinishLine();
+ // Update camera
+ updateCamera();
+};
+// Initialize the level
+createLevel();
\ No newline at end of file
Un changón con un tipo piloto peinado que tengo una ropa roja y negra y que sea tipo pixelar. In-Game asset. 2d. High contrast. No shadows
Que los enemigos sean como unas moscas que vuelan por ahí. In-Game asset. 2d. High contrast. No shadows
Que sea tipo una moneda que tenga el signo peso él medio. In-Game asset. 2d. High contrast. No shadows
Que sea una bandera y que tenga como un piso como frametista de carrera algo así. In-Game asset. 2d. High contrast. No shadows
Hace un rectángulo amarillo con un borde naranja una. In-Game asset. 2d. High contrast. No shadows
Un fondo todo celeste con nubes y un sol. In-Game asset. 2d. High contrast. No shadows
Que sea un un bloque alargado dd pasto. In-Game asset. 2d. High contrast. No shadows
Un corazon rojo. In-Game asset. 2d. High contrast. No shadows