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");
var storage = LK.import("@upit/storage.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 Button = Container.expand(function (text, width, height, color) {
var self = Container.call(this);
self.buttonWidth = width || 400;
self.buttonHeight = height || 100;
self.buttonColor = color || 0x4A90E2;
// Create button background
var bg = LK.getAsset('buttonBg', {
width: self.buttonWidth,
height: self.buttonHeight,
color: self.buttonColor,
shape: 'box',
anchorX: 0.5,
anchorY: 0.5
});
self.addChild(bg);
// Create button text
var buttonText = new Text2(text || 'Button', {
size: 50,
fill: '#FFFFFF'
});
buttonText.anchor.set(0.5, 0.5);
self.addChild(buttonText);
self.setText = function (newText) {
buttonText.setText(newText);
};
self.setColor = function (newColor) {
bg.tint = newColor;
};
self.down = function (x, y, obj) {
// Button press effect
self.scaleX = 0.95;
self.scaleY = 0.95;
if (self.onPress) self.onPress();
};
self.up = function (x, y, obj) {
// Button release effect
self.scaleX = 1.0;
self.scaleY = 1.0;
};
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 = 1;
self.direction = 1;
self.patrolDistance = 100;
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 FlyingEnemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
enemyGraphics.tint = 0x8844FF; // Purple tint for flying enemies
self.speed = 2;
self.direction = 1;
self.patrolDistance = 200;
self.startX = 0;
self.startY = 0;
self.bobOffset = 0;
self.update = function () {
// Horizontal movement
self.x += self.speed * self.direction;
// Turn around at patrol limits
if (Math.abs(self.x - self.startX) > self.patrolDistance) {
self.direction *= -1;
}
// Vertical bobbing motion
self.bobOffset += 0.05;
self.y = self.startY + Math.sin(self.bobOffset) * 30;
};
return self;
});
var GameUI = Container.expand(function () {
var self = Container.call(this);
// Left movement button
var leftBtn = new Button('◀', 180, 180, 0x333333);
leftBtn.x = 180;
leftBtn.y = 2500;
leftBtn.alpha = 0.8;
leftBtn.down = function () {
moveLeft = true;
moveRight = false;
this.setColor(0x555555);
};
leftBtn.up = function () {
moveLeft = false;
this.setColor(0x333333);
};
self.addChild(leftBtn);
// Right movement button
var rightBtn = new Button('▶', 180, 180, 0x333333);
rightBtn.x = 420;
rightBtn.y = 2500;
rightBtn.alpha = 0.8;
rightBtn.down = function () {
moveRight = true;
moveLeft = false;
this.setColor(0x555555);
};
rightBtn.up = function () {
moveRight = false;
this.setColor(0x333333);
};
self.addChild(rightBtn);
// Jump button - larger and more prominent
var jumpBtn = new Button('JUMP', 250, 180, 0x4CAF50);
jumpBtn.x = 1700;
jumpBtn.y = 2500;
jumpBtn.alpha = 0.9;
jumpBtn.down = function () {
if (player) player.jump();
this.setColor(0x66BB6A);
};
jumpBtn.up = function () {
this.setColor(0x4CAF50);
};
self.addChild(jumpBtn);
// Pause button
var pauseBtn = new Button('II', 100, 100, 0xFF9800);
pauseBtn.x = 1900;
pauseBtn.y = 200;
pauseBtn.alpha = 0.8;
pauseBtn.onPress = function () {
gameState = 'start';
clearLevel();
showStartScreen();
};
self.addChild(pauseBtn);
return self;
});
var LevelSelectScreen = Container.expand(function () {
var self = Container.call(this);
// Title
var title = new Text2('SELECT LEVEL', {
size: 100,
fill: '#FFFFFF'
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 400;
self.addChild(title);
// Level buttons
for (var i = 1; i <= maxLevel; i++) {
var levelBtn = new Button('LEVEL ' + i, 300, 100, 0x9C27B0);
levelBtn.x = 500 + (i - 1) * 350;
levelBtn.y = 800;
// Store level number in button
levelBtn.levelNumber = i;
levelBtn.onPress = function () {
currentLevel = this.levelNumber;
gameState = 'playing';
startGame();
};
self.addChild(levelBtn);
}
// Back button
var backBtn = new Button('BACK', 300, 80, 0x757575);
backBtn.x = 1024;
backBtn.y = 1600;
backBtn.onPress = function () {
gameState = 'start';
showStartScreen();
};
self.addChild(backBtn);
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
});
// Apply selected skin
if (selectedSkin !== 0xFFFFFF) {
playerGraphics.tint = selectedSkin;
}
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) {
storage.lastLevel = currentLevel;
LK.showGameOver();
}
};
self.jump = function () {
if (self.isGrounded) {
self.velocityY = -self.jumpPower;
self.isGrounded = false;
self.groundPlatform = null;
LK.getSound('jump').play();
}
};
return self;
});
var SkinSelectScreen = Container.expand(function () {
var self = Container.call(this);
// Title
var title = new Text2('CHOOSE SKIN', {
size: 100,
fill: '#FFFFFF'
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 400;
self.addChild(title);
// Skin options
var skinOptions = [{
name: 'DEFAULT',
color: 0xFFFFFF
}, {
name: 'RED',
color: 0xFF4444
}, {
name: 'BLUE',
color: 0x4444FF
}, {
name: 'GREEN',
color: 0x44FF44
}];
for (var i = 0; i < skinOptions.length; i++) {
var skinBtn = new Button(skinOptions[i].name, 250, 100, skinOptions[i].color);
skinBtn.x = 300 + i % 2 * 450;
skinBtn.y = 700 + Math.floor(i / 2) * 200;
// Store skin data
skinBtn.skinColor = skinOptions[i].color;
skinBtn.onPress = function () {
selectedSkin = this.skinColor;
storage.selectedSkin = selectedSkin;
};
self.addChild(skinBtn);
}
// Back button
var backBtn = new Button('BACK', 300, 80, 0x757575);
backBtn.x = 1024;
backBtn.y = 1600;
backBtn.onPress = function () {
gameState = 'start';
showStartScreen();
};
self.addChild(backBtn);
return self;
});
var StartScreen = Container.expand(function () {
var self = Container.call(this);
// Title
var title = new Text2('PLATFORM COIN RUSH', {
size: 120,
fill: '#FFFFFF'
});
title.anchor.set(0.5, 0.5);
title.x = 1024;
title.y = 500;
self.addChild(title);
// Check if there's a last level to resume
var hasLastLevel = storage.lastLevel && storage.lastLevel > 0;
// Start/Resume button
var startBtn = new Button(hasLastLevel ? 'RESUME LEVEL ' + storage.lastLevel : 'START GAME', 500, 120, 0x4CAF50);
startBtn.x = 1024;
startBtn.y = 1000;
startBtn.onPress = function () {
if (hasLastLevel) {
currentLevel = storage.lastLevel;
gameState = 'playing';
startGame();
} else {
gameState = 'level_select';
showLevelSelect();
}
};
self.addChild(startBtn);
// Level select button
var levelBtn = new Button('SELECT LEVEL', 500, 120, 0x2196F3);
levelBtn.x = 1024;
levelBtn.y = 1200;
levelBtn.onPress = function () {
gameState = 'level_select';
showLevelSelect();
};
self.addChild(levelBtn);
// Skin select button
var skinBtn = new Button('CHOOSE SKIN', 500, 120, 0xFF9800);
skinBtn.x = 1024;
skinBtn.y = 1400;
skinBtn.onPress = function () {
gameState = 'skin_select';
showSkinSelect();
};
self.addChild(skinBtn);
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var player;
var platforms = [];
var breakablePlatforms = [];
var enemies = [];
var coins = [];
var flyingEnemies = [];
var background;
var finishLine;
// Camera offset
var cameraX = 0;
// Controls
var moveLeft = false;
var moveRight = false;
// Level system
var currentLevel = 1;
var maxLevel = 8;
// Game state management
var gameState = 'start'; // 'start', 'level_select', 'skin_select', 'playing'
var startScreen;
var levelSelectScreen;
var skinSelectScreen;
var gameUI;
// Skin system
var selectedSkin = storage.selectedSkin || 0xFFFFFF;
// UI
var scoreTxt = new Text2('Coins: 0', {
size: 80,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0, 0);
LK.gui.topLeft.addChild(scoreTxt);
// Screen management functions
function showStartScreen() {
clearAllScreens();
startScreen = game.addChild(new StartScreen());
}
function showLevelSelect() {
clearAllScreens();
levelSelectScreen = game.addChild(new LevelSelectScreen());
}
function showSkinSelect() {
clearAllScreens();
skinSelectScreen = game.addChild(new SkinSelectScreen());
}
function clearAllScreens() {
if (startScreen) {
startScreen.destroy();
startScreen = null;
}
if (levelSelectScreen) {
levelSelectScreen.destroy();
levelSelectScreen = null;
}
if (skinSelectScreen) {
skinSelectScreen.destroy();
skinSelectScreen = null;
}
if (gameUI) {
gameUI.destroy();
gameUI = null;
}
}
function startGame() {
clearAllScreens();
clearLevel();
createLevel();
gameUI = game.addChild(new GameUI());
}
// Initialize level
function createLevel() {
// Create player
player = game.addChild(new Player());
player.x = 200;
player.y = 2200;
// Generate level data based on current level
var levelData = generateLevelData(currentLevel);
// Create platforms
levelData.platforms.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
levelData.enemies.forEach(function (data) {
if (data.type === 'ground') {
var enemy = game.addChild(new Enemy());
enemy.x = data.x;
enemy.y = data.y;
enemy.startX = data.x;
enemies.push(enemy);
} else if (data.type === 'flying') {
var flyingEnemy = game.addChild(new FlyingEnemy());
flyingEnemy.x = data.x;
flyingEnemy.y = data.y;
flyingEnemy.startX = data.x;
flyingEnemy.startY = data.y;
enemies.push(flyingEnemy);
}
});
// Create animated background
background = game.addChild(LK.getAsset('background', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0
}));
// Send background to back
game.setChildIndex(background, 0);
// Create coins
levelData.coins.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 = levelData.finishX;
finishLine.y = levelData.finishY;
}
// 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)) {
storage.lastLevel = currentLevel;
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)) {
// Clear last level from storage since level was completed
storage.lastLevel = null;
currentLevel++;
if (currentLevel > maxLevel) {
LK.showYouWin();
} else {
// Clear current level
clearLevel();
// Create next level
createLevel();
}
}
}
function clearLevel() {
// Remove all game objects
platforms.forEach(function (platform) {
platform.destroy();
});
breakablePlatforms.forEach(function (platform) {
platform.destroy();
});
enemies.forEach(function (enemy) {
enemy.destroy();
});
coins.forEach(function (coin) {
coin.destroy();
});
if (background) background.destroy();
if (finishLine) finishLine.destroy();
if (player) player.destroy();
// Clear arrays
platforms = [];
breakablePlatforms = [];
enemies = [];
coins = [];
flyingEnemies = [];
// Reset camera
cameraX = 0;
game.x = 0;
}
function updateCamera() {
// Follow player with camera - closer zoom
var targetCameraX = player.x - 700; // Moved from 1024 to 700 for closer view
cameraX += (targetCameraX - cameraX) * 0.15; // Increased responsiveness
// Limit camera bounds - dynamic based on level
if (cameraX < 0) cameraX = 0;
var maxCameraX = 3000 + currentLevel * 800; // Increased from 2000 + currentLevel * 400
if (cameraX > maxCameraX) cameraX = maxCameraX;
game.x = -cameraX;
}
// Touch controls - only active during gameplay
game.down = function (x, y, obj) {
if (gameState !== 'playing') return;
// Only handle movement, jump is handled by button
if (!obj || obj === game) {
// 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) {
if (gameState !== 'playing') return;
moveLeft = false;
moveRight = false;
};
game.update = function () {
// Only update game logic when playing
if (gameState !== 'playing') return;
// 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 with start screen
showStartScreen();
function generateLevelData(level) {
var baseData = {
platforms: [],
enemies: [],
coins: [],
finishX: 0,
finishY: 0
};
// Level-specific layouts
if (level === 1) {
// Easy level - varied platform layout
baseData.platforms = [{
x: 200,
y: 2300,
type: 'platform'
}, {
x: 500,
y: 2200,
type: 'platform'
}, {
x: 800,
y: 2100,
type: 'platform'
}, {
x: 650,
y: 1950,
type: 'platform'
}, {
x: 1100,
y: 1850,
type: 'platform'
}, {
x: 900,
y: 1700,
type: 'platform'
}, {
x: 1350,
y: 1600,
type: 'platform'
}, {
x: 1600,
y: 1450,
type: 'platform'
}, {
x: 1900,
y: 1300,
type: 'platform'
}, {
x: 2200,
y: 1150,
type: 'breakable'
}, {
x: 2500,
y: 1000,
type: 'platform'
}, {
x: 2800,
y: 850,
type: 'platform'
}];
baseData.enemies = [{
x: 350,
y: 1940,
type: 'ground'
}, {
x: 1000,
y: 1740,
type: 'ground'
}, {
x: 1600,
y: 1390,
type: 'ground'
}, {
x: 2200,
y: 1090,
type: 'ground'
}, {
x: 1750,
y: 1100,
type: 'flying'
}];
baseData.coins = [{
x: 300,
y: 2200
}, {
x: 500,
y: 2050
}, {
x: 700,
y: 1900
}, {
x: 900,
y: 1750
}, {
x: 1100,
y: 1600
}, {
x: 1300,
y: 1450
}, {
x: 1500,
y: 1300
}, {
x: 1700,
y: 1200
}, {
x: 1900,
y: 1150
}, {
x: 2100,
y: 1050
}, {
x: 2300,
y: 950
}, {
x: 2500,
y: 850
}, {
x: 2700,
y: 750
}];
baseData.finishX = 2900;
baseData.finishY = 750;
} else if (level === 2) {
// Introduce breakable platforms with varied layout
baseData.platforms = [{
x: 200,
y: 2300,
type: 'platform'
}, {
x: 550,
y: 2150,
type: 'breakable'
}, {
x: 350,
y: 2000,
type: 'platform'
}, {
x: 750,
y: 1950,
type: 'breakable'
}, {
x: 1000,
y: 1800,
type: 'platform'
}, {
x: 800,
y: 1650,
type: 'platform'
}, {
x: 1250,
y: 1550,
type: 'breakable'
}, {
x: 1500,
y: 1400,
type: 'platform'
}, {
x: 1750,
y: 1250,
type: 'platform'
}];
baseData.enemies = [{
x: 800,
y: 1590,
type: 'ground'
}, {
x: 1500,
y: 1340,
type: 'ground'
}, {
x: 900,
y: 1400,
type: 'flying'
}];
baseData.coins = [{
x: 300,
y: 2200
}, {
x: 500,
y: 2050
}, {
x: 700,
y: 1900
}, {
x: 900,
y: 1750
}, {
x: 1100,
y: 1600
}, {
x: 1300,
y: 1450
}, {
x: 1500,
y: 1300
}, {
x: 1700,
y: 1150
}];
baseData.finishX = 1900;
baseData.finishY = 1100;
} else if (level === 3) {
// Add flying enemies
baseData.platforms = [{
x: 200,
y: 2300,
type: 'platform'
}, {
x: 450,
y: 2100,
type: 'platform'
}, {
x: 700,
y: 1900,
type: 'breakable'
}, {
x: 950,
y: 1700,
type: 'platform'
}, {
x: 1200,
y: 1500,
type: 'breakable'
}, {
x: 1450,
y: 1300,
type: 'platform'
}, {
x: 1700,
y: 1100,
type: 'platform'
}, {
x: 1950,
y: 900,
type: 'breakable'
}, {
x: 2200,
y: 700,
type: 'platform'
}];
baseData.enemies = [{
x: 950,
y: 1640,
type: 'ground'
}, {
x: 1700,
y: 1040,
type: 'ground'
}, {
x: 1100,
y: 1200,
type: 'flying'
}];
baseData.coins = [{
x: 325,
y: 2200
}, {
x: 575,
y: 2000
}, {
x: 825,
y: 1800
}, {
x: 1075,
y: 1600
}, {
x: 1325,
y: 1400
}, {
x: 1575,
y: 1200
}, {
x: 1825,
y: 1000
}, {
x: 2075,
y: 800
}, {
x: 2325,
y: 600
}];
baseData.finishX = 2300;
baseData.finishY = 700;
} else if (level === 4) {
// More complex layout
baseData.platforms = [{
x: 200,
y: 2300,
type: 'platform'
}, {
x: 400,
y: 2150,
type: 'breakable'
}, {
x: 650,
y: 1950,
type: 'platform'
}, {
x: 850,
y: 1800,
type: 'breakable'
}, {
x: 1100,
y: 1600,
type: 'platform'
}, {
x: 1300,
y: 1450,
type: 'breakable'
}, {
x: 1550,
y: 1250,
type: 'platform'
}, {
x: 1750,
y: 1100,
type: 'breakable'
}, {
x: 2000,
y: 900,
type: 'platform'
}, {
x: 2250,
y: 700,
type: 'platform'
}, {
x: 2500,
y: 500,
type: 'breakable'
}, {
x: 2750,
y: 300,
type: 'platform'
}];
baseData.enemies = [{
x: 1100,
y: 1540,
type: 'ground'
}, {
x: 2000,
y: 840,
type: 'ground'
}, {
x: 1400,
y: 1000,
type: 'flying'
}, {
x: 2400,
y: 600,
type: 'flying'
}];
baseData.coins = [{
x: 300,
y: 2200
}, {
x: 525,
y: 2050
}, {
x: 775,
y: 1850
}, {
x: 975,
y: 1700
}, {
x: 1225,
y: 1500
}, {
x: 1425,
y: 1350
}, {
x: 1675,
y: 1150
}, {
x: 1875,
y: 1000
}, {
x: 2125,
y: 800
}, {
x: 2375,
y: 600
}, {
x: 2625,
y: 400
}];
baseData.finishX = 2850;
baseData.finishY = 300;
} else {
// Generate procedural levels for 5-8 with varied patterns
var platformCount = 25 + level * 4; // Increased from 15 + level * 2
var currentX = 200;
var currentY = 2300;
var direction = 1; // 1 for right, -1 for left
var verticalDirection = -1; // Always going up
for (var i = 0; i < platformCount; i++) {
baseData.platforms.push({
x: currentX,
y: currentY,
type: Math.random() < 0.6 ? 'breakable' : 'platform' // Increased breakable chance from 0.4 to 0.6
});
// Add additional platforms for more complex jumping patterns
if (Math.random() < 0.3 && i > 2) {
// Add a secondary platform at different height
var secondaryX = currentX + (Math.random() - 0.5) * 400;
var secondaryY = currentY + (Math.random() - 0.5) * 200;
baseData.platforms.push({
x: secondaryX,
y: secondaryY,
type: Math.random() < 0.7 ? 'breakable' : 'platform'
});
}
// Add coin near each platform
baseData.coins.push({
x: currentX + (Math.random() - 0.5) * 80,
y: currentY - 80
});
// Randomly add enemies with better positioning
if (Math.random() < 0.5 && i > 1) {
// Increased from 0.3 to 0.5
var enemyType = Math.random() < 0.6 ? 'ground' : 'flying'; // More flying enemies
var enemyY = enemyType === 'ground' ? currentY - 60 : currentY - 150;
baseData.enemies.push({
x: currentX + (Math.random() - 0.5) * 150,
y: enemyY,
type: enemyType
});
}
// Add additional enemies in clusters for increased difficulty
if (Math.random() < 0.25 && i > 3) {
for (var j = 0; j < 2; j++) {
var clusterEnemyType = Math.random() < 0.5 ? 'ground' : 'flying';
var clusterEnemyY = clusterEnemyType === 'ground' ? currentY - 60 : currentY - 200;
baseData.enemies.push({
x: currentX + (j - 0.5) * 300 + (Math.random() - 0.5) * 100,
y: clusterEnemyY,
type: clusterEnemyType
});
}
}
// More organic movement pattern
var xMove = 150 + Math.random() * 200;
var yMove = 80 + Math.random() * 120;
// Sometimes change direction horizontally
if (Math.random() < 0.3) direction *= -1;
// Occasionally create vertical challenges
if (Math.random() < 0.2) yMove *= 2;
currentX += xMove * direction;
currentY += yMove * verticalDirection;
// Keep X within reasonable bounds
if (currentX < 100) {
currentX = 100;
direction = 1;
}
if (currentX > 2500) {
currentX = 2500;
direction = -1;
}
}
baseData.finishX = currentX + 200;
baseData.finishY = currentY - 100;
}
return baseData;
} ===================================================================
--- original.js
+++ change.js
@@ -619,9 +619,9 @@
var targetCameraX = player.x - 700; // Moved from 1024 to 700 for closer view
cameraX += (targetCameraX - cameraX) * 0.15; // Increased responsiveness
// Limit camera bounds - dynamic based on level
if (cameraX < 0) cameraX = 0;
- var maxCameraX = 2000 + currentLevel * 400;
+ var maxCameraX = 3000 + currentLevel * 800; // Increased from 2000 + currentLevel * 400
if (cameraX > maxCameraX) cameraX = maxCameraX;
game.x = -cameraX;
}
// Touch controls - only active during gameplay
@@ -706,8 +706,24 @@
}, {
x: 1600,
y: 1450,
type: 'platform'
+ }, {
+ x: 1900,
+ y: 1300,
+ type: 'platform'
+ }, {
+ x: 2200,
+ y: 1150,
+ type: 'breakable'
+ }, {
+ x: 2500,
+ y: 1000,
+ type: 'platform'
+ }, {
+ x: 2800,
+ y: 850,
+ type: 'platform'
}];
baseData.enemies = [{
x: 350,
y: 1940,
@@ -715,8 +731,20 @@
}, {
x: 1000,
y: 1740,
type: 'ground'
+ }, {
+ x: 1600,
+ y: 1390,
+ type: 'ground'
+ }, {
+ x: 2200,
+ y: 1090,
+ type: 'ground'
+ }, {
+ x: 1750,
+ y: 1100,
+ type: 'flying'
}];
baseData.coins = [{
x: 300,
y: 2200
@@ -737,11 +765,29 @@
y: 1450
}, {
x: 1500,
y: 1300
+ }, {
+ x: 1700,
+ y: 1200
+ }, {
+ x: 1900,
+ y: 1150
+ }, {
+ x: 2100,
+ y: 1050
+ }, {
+ x: 2300,
+ y: 950
+ }, {
+ x: 2500,
+ y: 850
+ }, {
+ x: 2700,
+ y: 750
}];
- baseData.finishX = 1700;
- baseData.finishY = 1250;
+ baseData.finishX = 2900;
+ baseData.finishY = 750;
} else if (level === 2) {
// Introduce breakable platforms with varied layout
baseData.platforms = [{
x: 200,
@@ -1007,34 +1053,58 @@
baseData.finishX = 2850;
baseData.finishY = 300;
} else {
// Generate procedural levels for 5-8 with varied patterns
- var platformCount = 15 + level * 2;
+ var platformCount = 25 + level * 4; // Increased from 15 + level * 2
var currentX = 200;
var currentY = 2300;
var direction = 1; // 1 for right, -1 for left
var verticalDirection = -1; // Always going up
for (var i = 0; i < platformCount; i++) {
baseData.platforms.push({
x: currentX,
y: currentY,
- type: Math.random() < 0.4 ? 'breakable' : 'platform'
+ type: Math.random() < 0.6 ? 'breakable' : 'platform' // Increased breakable chance from 0.4 to 0.6
});
+ // Add additional platforms for more complex jumping patterns
+ if (Math.random() < 0.3 && i > 2) {
+ // Add a secondary platform at different height
+ var secondaryX = currentX + (Math.random() - 0.5) * 400;
+ var secondaryY = currentY + (Math.random() - 0.5) * 200;
+ baseData.platforms.push({
+ x: secondaryX,
+ y: secondaryY,
+ type: Math.random() < 0.7 ? 'breakable' : 'platform'
+ });
+ }
// Add coin near each platform
baseData.coins.push({
x: currentX + (Math.random() - 0.5) * 80,
y: currentY - 80
});
// Randomly add enemies with better positioning
- if (Math.random() < 0.3 && i > 1) {
- var enemyType = Math.random() < 0.7 ? 'ground' : 'flying';
+ if (Math.random() < 0.5 && i > 1) {
+ // Increased from 0.3 to 0.5
+ var enemyType = Math.random() < 0.6 ? 'ground' : 'flying'; // More flying enemies
var enemyY = enemyType === 'ground' ? currentY - 60 : currentY - 150;
baseData.enemies.push({
x: currentX + (Math.random() - 0.5) * 150,
y: enemyY,
type: enemyType
});
}
+ // Add additional enemies in clusters for increased difficulty
+ if (Math.random() < 0.25 && i > 3) {
+ for (var j = 0; j < 2; j++) {
+ var clusterEnemyType = Math.random() < 0.5 ? 'ground' : 'flying';
+ var clusterEnemyY = clusterEnemyType === 'ground' ? currentY - 60 : currentY - 200;
+ baseData.enemies.push({
+ x: currentX + (j - 0.5) * 300 + (Math.random() - 0.5) * 100,
+ y: clusterEnemyY,
+ type: clusterEnemyType
+ });
+ }
+ }
// More organic movement pattern
var xMove = 150 + Math.random() * 200;
var yMove = 80 + Math.random() * 120;
// Sometimes change direction horizontally
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