User prompt
reduce la orbita de bonus y mantenlo equidistantes
User prompt
a los bonus amplia la orbita
User prompt
coloca a deco dentro de assets
User prompt
reduce radio de orbita
User prompt
amplia el rango de orbita a todo
User prompt
mete los deco en su misma orbita
User prompt
pon 6 deco
User prompt
coloca a deco equidistante y mas lento
User prompt
que los objetos no orbiten tan afuera de la pantalla
User prompt
reduce radio de deco
User prompt
reduce la distancias de los bonus
User prompt
el tercer bonus de afuera reduce el tamaño de su orbira
User prompt
el bonus que tiene el radio mas abierto cierralo mas
User prompt
cierra el radio de orbita de bonus
User prompt
deco debe estar cerca del centro
User prompt
crea orbita en un radio a deco
User prompt
amplia el radio
User prompt
agrega 5 deco
User prompt
elimina 15 deco
User prompt
5 deco
User prompt
reduce los deco
User prompt
crea orbita a deco y coloca 10 deco equidistantes
User prompt
deco rotara al contrario de bono a gran velocidad
User prompt
crea un nuevo objeto llamado deco
User prompt
agrega otro objeto que orbita mas rapido que todos
/****
* Classes
****/
// Define Bonus class
var Bonus = Container.expand(function () {
var self = Container.call(this);
// Attach a bonus asset (use a star-like color and ellipse shape for visibility)
var bonusGraphics = self.attachAsset('bonus', {
anchorX: 0.5,
anchorY: 0.5
});
// Orbit parameters
self.orbitRadius = 170; // Default closer to center, will be overridden in Game Code
self.orbitAngle = Math.random() * Math.PI * 2; // Random start
// self.orbitSpeed will be set per instance in Game Code
// Update method for orbiting
self.update = function () {
self.orbitAngle += self.orbitSpeed;
self.x = 1024 + self.orbitRadius * Math.cos(self.orbitAngle);
self.y = 1366 + self.orbitRadius * Math.sin(self.orbitAngle);
};
return self;
});
// Define Deco class
var Deco = Container.expand(function () {
var self = Container.call(this);
// Use the 'deco' asset from Assets section
var decoGraphics = self.attachAsset('deco', {
anchorX: 0.5,
anchorY: 0.5
});
// Optionally, scale for visual distinction
decoGraphics.scaleX = 1.5;
decoGraphics.scaleY = 1.5;
// Deco does not move or update by default, but you can add animation here if needed
self.orbitRadius = 170; // Default to match average bonus orbit, will be overridden in Game Code
self.orbitAngle = Math.random() * Math.PI * 2;
self.orbitSpeed = -0.03; // Slower by default, will be overridden in Game Code if needed
self.update = function () {
self.orbitAngle += self.orbitSpeed;
self.x = 1024 + self.orbitRadius * Math.cos(self.orbitAngle);
self.y = 1366 + self.orbitRadius * Math.sin(self.orbitAngle);
};
return self;
});
// Position near the top
// Define Enemy class
var Enemy = Container.expand(function () {
var self = Container.call(this);
// Attach enemy asset
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
// Set initial position and movement properties
self.speed = 1.2; // Lowered for better perception
self.direction = 1; // 1 for right, -1 for left
// Update method for enemy movement
self.update = function () {
self.x += self.speed * self.direction;
// Reverse direction if enemy hits screen bounds
if (self.x < 0 || self.x > 2048) {
self.direction *= -1;
}
};
});
// Define Player class
var Player = Container.expand(function () {
var self = Container.call(this);
// Attach player asset
var playerGraphics = self.attachAsset('Ballplayer', {
anchorX: 0.5,
anchorY: 0.5
});
// Set initial position and movement properties
self.speed = 2.5; // Lowered for better perception
// Update method for player movement
self.update = function () {
// Movement handled by keyboard events
};
});
/****
* Initialize Game
****/
// Reset Assets section to initial state
// Reset Asteroid class definition
//<Assets used in the game will automatically appear here>
// Reset Planet class definition
// Reset Star class definition
// Reset Initialize Game section to initial state
// Reset Game Code section to initial state
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
// Add a player to the game
var player = game.addChild(new Player());
// Add 6 deco objects, all sharing the same orbit (same radius, speed, and direction)
var decos = [];
var decoCount = 6;
var sharedDecoOrbitRadius = 600; // All decos on the same orbit, now covers a smaller area
var sharedDecoOrbitSpeed = -0.01; // Keep slow for visual clarity
for (var i = 0; i < decoCount; i++) {
var deco = game.addChild(new Deco());
deco.orbitRadius = sharedDecoOrbitRadius;
deco.orbitAngle = Math.PI * 2 / decoCount * i;
deco.orbitSpeed = sharedDecoOrbitSpeed;
decos.push(deco);
}
// Define orbits
var orbits = [140, 180, 220]; // Reduced bonus orbits, closer to center and equidistant
// Create three bonus objects, each occupying a unique orbit
var bonuses = [];
for (var i = 0; i < 3; i++) {
var b = game.addChild(new Bonus());
b.orbitIndex = i;
b.orbitRadius = orbits[i];
b.orbitSpeed = 0.04 + Math.random() * 0.09;
b.orbitAngle = Math.PI * 2 / 3 * i; // Equidistant angles
bonuses.push(b);
}
// Add a new fast-orbiting object (superBonus) that orbits faster than all bonuses
var superBonus = game.addChild(new Bonus());
superBonus.orbitIndex = 3; // Not on the same orbits as bonuses, but can use a new or existing radius
superBonus.orbitRadius = 320; // Reduced radius to keep inside screen
superBonus.orbitSpeed = 0.18 + Math.random() * 0.04; // Much faster than normal bonuses
superBonus.orbitAngle = Math.random() * Math.PI * 2;
// (Removed unnecessary update of deco.orbitRadius)
// Add level number display at the top center of the screen
var levelText = new Text2('Nivel 1', {
size: 100,
fill: 0xFFFFFF
});
levelText.anchor.set(0.5, 0); // Center horizontally, top edge
LK.gui.top.addChild(levelText);
// Add score display at the top right
var score = 0;
var scoreText = new Text2('Puntos: 0', {
size: 100,
fill: 0xFFFF00
});
scoreText.anchor.set(1, 0); // Right aligned, top edge
LK.gui.topRight.addChild(scoreText);
// Set initial position of the player
player.x = 1024; // Center horizontally
player.y = 2632; // Always at the bottom (100px from bottom edge)
// Store the center of the screen for easy reference
var centerX = 1024;
var centerY = 1366;
// Define orbits
var orbits = [110, 170, 230];
// Track the player's current angle and radius from the center
player.angle = Math.atan2(player.y - centerY, player.x - centerX);
player.radius = Math.sqrt((player.x - centerX) * (player.x - centerX) + (player.y - centerY) * (player.y - centerY));
// Keyboard controls removed for compatibility; player movement is now handled by other means.
// Function to find the next closest orbit
function getNextOrbit(currentY) {
var currentOrbit = 2732 - currentY;
for (var i = 0; i < orbits.length; i++) {
if (orbits[i] > currentOrbit) {
return 2732 - orbits[i];
}
;
// --- Super Bonus object update and collision (fastest orbiting object) ---
if (typeof superBonus !== "undefined" && superBonus) {
superBonus.update();
if (superBonus.lastWasIntersecting === undefined) superBonus.lastWasIntersecting = false;
var sbIntersecting = superBonus.intersects(player);
if (!superBonus.lastWasIntersecting && sbIntersecting) {
// Player just collected the super bonus!
score += 200;
if (typeof scoreText !== "undefined" && scoreText.setText) {
scoreText.setText('Puntos: ' + score);
}
// Move superBonus to a new random angle and randomize its speed (always fast)
superBonus.orbitAngle = Math.random() * Math.PI * 2;
superBonus.orbitSpeed = 0.18 + Math.random() * 0.04;
}
superBonus.lastWasIntersecting = sbIntersecting;
}
;
// --- Deco fast counter-orbit update for all decos ---
if (typeof decos !== "undefined" && decos.length) {
for (var i = 0; i < decos.length; i++) {
var deco = decos[i];
deco.orbitAngle += deco.orbitSpeed;
deco.x = centerX + deco.orbitRadius * Math.cos(deco.orbitAngle);
deco.y = centerY + deco.orbitRadius * Math.sin(deco.orbitAngle);
}
}
}
;
;
// Add a new orbit to the end of the array to create an infinite loop
var newOrbit = orbits[orbits.length - 1] + 400;
orbits.push(newOrbit);
return 2732 - newOrbit;
}
// Track if right mouse button is held down
var rightMouseDown = false;
// Track if left mouse button is held down
var leftMouseDown = false;
// Add event listener for mouse click
game.down = function (x, y, obj) {
// Detect left or right click
var isRightClick = false;
if (obj && obj.event && obj.event.button !== undefined) {
isRightClick = obj.event.button === 2;
}
if (isRightClick) {
rightMouseDown = true;
} else {
leftMouseDown = true;
}
// Update player position based on new angle and current radius
player.x = centerX + player.radius * Math.cos(player.angle);
player.y = centerY + player.radius * Math.sin(player.angle);
};
// Add event listener for mouse up to stop moving towards center
game.up = function (x, y, obj) {
var isRightClick = false;
if (obj && obj.event && obj.event.button !== undefined) {
isRightClick = obj.event.button === 2;
}
if (isRightClick) {
rightMouseDown = false;
} else {
leftMouseDown = false;
}
};
// Set initial number of enemies for level 1 (3 enemies), and increase by 1 per level
var currentLevel = 1;
var enemies = [];
function spawnEnemiesForLevel(level) {
// Remove existing enemies from game
for (var i = 0; i < enemies.length; i++) {
if (enemies[i].parent) enemies[i].parent.removeChild(enemies[i]);
}
enemies = [];
var numEnemies = 3 * level;
var baseRadii = [110, 170, 230, 290, 320, 200, 260, 300];
for (var i = 0; i < numEnemies; i++) {
var enemy = game.addChild(new Enemy());
// Assign a random color to the enemy's graphics
if (enemy.children && enemy.children.length > 0 && enemy.children[0]) {
// Generate a random color in 0xRRGGBB format
var randomColor = Math.floor(Math.random() * 0xFFFFFF) | 0;
enemy.children[0].color = randomColor;
// If the asset supports .tint, set it as well for visual effect
if (typeof enemy.children[0].tint !== "undefined") {
enemy.children[0].tint = randomColor;
}
}
enemy.x = 1024;
enemy.y = 1366;
// Distribute orbits and angles for variety
var baseRadius = baseRadii[i % baseRadii.length];
enemy.orbitRadius = baseRadius + Math.floor(Math.random() * 120);
enemy.orbitAngle = Math.random() * Math.PI * 2;
enemy.orbitSpeed = 0.004 + Math.random() * 0.003;
// Alternate direction: odd = counterclockwise, even = clockwise
if (i % 2 === 1) {
enemy.orbitSpeed *= -1;
enemy.isCounterClockwise = true;
} else {
enemy.isCounterClockwise = false;
}
enemy.speed = 1.2 + Math.random() * 1.5;
// Add random direction change timer for some enemies
enemy.canChangeDirection = Math.random() < 0.5; // 50% chance
if (enemy.canChangeDirection) {
enemy.directionChangeInterval = 60 + Math.floor(Math.random() * 120); // 1-3 seconds
enemy.directionChangeTick = 0;
}
enemies.push(enemy);
}
}
// Spawn initial enemies for level 1
spawnEnemiesForLevel(currentLevel);
// Update method for orbiting
game.update = function () {
// Gravity: each frame, pull the player a bit toward the center
if (typeof currentLevel === "undefined") {
var gravityStrength = 1.1;
} else {
// Increase gravityStrength by 0.001 per level (in thousandths)
var gravityStrength = 1.1 + (currentLevel - 1) * 0.001;
}
player.radius = Math.max(80, player.radius - gravityStrength);
player.x = centerX + player.radius * Math.cos(player.angle);
player.y = centerY + player.radius * Math.sin(player.angle);
// --- LEVEL SYSTEM: Track and progress levels up to 20 ---
if (typeof currentLevel === "undefined") {
var currentLevel = 1;
var maxLevels = 20;
}
if (player.lastRadius === undefined) player.lastRadius = player.radius;
if (player.lastRadius > 80 && player.radius <= 80) {
// Player just reached the center!
// Give 100 points for reaching the center
if (typeof score !== "undefined") {
score += 100;
if (typeof scoreText !== "undefined" && scoreText.setText) {
scoreText.setText('Puntos: ' + score);
}
}
if (currentLevel < maxLevels) {
currentLevel++;
// Update level number display
if (typeof levelText !== "undefined" && levelText.setText) {
levelText.setText('Nivel ' + currentLevel);
}
// Intensify enemy orbits and speed for new level, but clamp to max for perception
for (var i = 0; i < enemies.length; i++) {
enemies[i].orbitSpeed = Math.min(enemies[i].orbitSpeed * 1.5, 0.045); // Clamp to max
enemies[i].speed = Math.min(enemies[i].speed * 1.25, 7); // Clamp to max
}
// Always set number of enemies to 3 + (currentLevel - 1)
spawnEnemiesForLevel(currentLevel);
// Add rotation/orbit variants: some reverse, some elliptical
for (var k = 0; k < enemies.length; k++) {
// Every 3rd enemy or at higher levels, make elliptical orbits
if ((k + currentLevel) % 3 === 0 && currentLevel > 4) {
enemies[k].ellipseA = enemies[k].orbitRadius;
enemies[k].ellipseB = Math.max(120, enemies[k].orbitRadius - 60 - Math.random() * 80);
enemies[k].isElliptical = true;
} else {
enemies[k].isElliptical = false;
}
// Alternate direction for more chaos
if (currentLevel > 6 && k % 2 === 0) {
enemies[k].orbitSpeed = -Math.abs(enemies[k].orbitSpeed);
} else {
enemies[k].orbitSpeed = Math.abs(enemies[k].orbitSpeed);
}
}
// Reset player to starting position for next level (center bottom of the screen)
player.x = 1024; // Center horizontally
player.y = 2632; // 100px from bottom edge
player.radius = Math.sqrt((player.x - centerX) * (player.x - centerX) + (player.y - centerY) * (player.y - centerY));
player.angle = Math.atan2(player.y - centerY, player.x - centerX);
// Optionally, randomize enemy orbits a bit for variety
for (var j = 0; j < enemies.length; j++) {
enemies[j].orbitAngle = Math.random() * Math.PI * 2;
}
} else {
// Completed all levels, show win
LK.showYouWin();
}
}
player.lastRadius = player.radius;
// Move player towards the center if right mouse button is held down (extra boost)
if (typeof rightMouseDown !== "undefined" && rightMouseDown) {
// Each frame, move the player 3.5px closer to the center, but not below a minimum radius of 80
player.radius = Math.max(80, player.radius - 3.5);
player.x = centerX + player.radius * Math.cos(player.angle);
player.y = centerY + player.radius * Math.sin(player.angle);
}
// Rotate player if left mouse button is held down
if (typeof leftMouseDown !== "undefined" && leftMouseDown) {
player.angle += 0.035; // Slower, smoother rotation for perception
// When rotating, accelerate gravity (move faster to center)
player.radius = Math.max(80, player.radius - gravityStrength * 2.5);
player.x = centerX + player.radius * Math.cos(player.angle);
player.y = centerY + player.radius * Math.sin(player.angle);
}
enemies.forEach(function (enemy) {
// Randomly change direction if enabled, but only after 3 full orbits in one direction
if (enemy.canChangeDirection) {
if (enemy.directionChangeTick === undefined) enemy.directionChangeTick = 0;
if (enemy.orbitDirectionStartAngle === undefined) enemy.orbitDirectionStartAngle = enemy.orbitAngle;
if (enemy.orbitsInCurrentDirection === undefined) enemy.orbitsInCurrentDirection = 0;
enemy.directionChangeTick++;
// Calculate how many full orbits have been completed in the current direction
var angleDiff = enemy.orbitAngle - enemy.orbitDirectionStartAngle;
// Normalize to [0, 2PI)
var fullOrbits = Math.abs(angleDiff) / (Math.PI * 2);
// Only increment if we passed a full orbit since last check
if (enemy.lastFullOrbits === undefined) enemy.lastFullOrbits = 0;
if (Math.floor(fullOrbits) > enemy.lastFullOrbits) {
enemy.orbitsInCurrentDirection += Math.floor(fullOrbits) - enemy.lastFullOrbits;
enemy.lastFullOrbits = Math.floor(fullOrbits);
}
if (enemy.directionChangeTick >= enemy.directionChangeInterval && enemy.orbitsInCurrentDirection >= 3) {
// Flip direction
enemy.orbitSpeed *= -1;
enemy.directionChangeTick = 0;
// Reset orbit tracking for new direction
enemy.orbitDirectionStartAngle = enemy.orbitAngle;
enemy.orbitsInCurrentDirection = 0;
enemy.lastFullOrbits = 0;
// Optionally, randomize next interval
enemy.directionChangeInterval = 60 + Math.floor(Math.random() * 120);
}
}
enemy.orbitAngle += enemy.orbitSpeed;
if (enemy.isElliptical) {
// Elliptical orbit
var a = enemy.ellipseA || enemy.orbitRadius;
var b = enemy.ellipseB || enemy.orbitRadius - 60;
enemy.x = centerX + a * Math.cos(enemy.orbitAngle);
enemy.y = centerY + b * Math.sin(enemy.orbitAngle);
} else {
// Circular orbit
enemy.x = centerX + enemy.orbitRadius * Math.cos(enemy.orbitAngle);
enemy.y = centerY + enemy.orbitRadius * Math.sin(enemy.orbitAngle);
}
// --- Collision detection with player ---
if (enemy.lastWasIntersecting === undefined) enemy.lastWasIntersecting = false;
var isIntersecting = enemy.intersects(player);
if (!enemy.lastWasIntersecting && isIntersecting) {
// Collision just started, trigger game over
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
enemy.lastWasIntersecting = isIntersecting;
});
// --- Bonus objects update and collision (three bonuses, one per orbit) ---
if (bonuses && bonuses.length) {
for (var i = 0; i < bonuses.length; i++) {
var bonus = bonuses[i];
bonus.update();
if (bonus.lastWasIntersecting === undefined) bonus.lastWasIntersecting = false;
var bIntersecting = bonus.intersects(player);
if (!bonus.lastWasIntersecting && bIntersecting) {
// Player just collected the bonus!
score += 50;
if (typeof scoreText !== "undefined" && scoreText.setText) {
scoreText.setText('Puntos: ' + score);
}
// Move this bonus to a new random angle on its own orbit (keep orbitIndex fixed)
bonus.orbitAngle = Math.random() * Math.PI * 2;
bonus.orbitSpeed = 0.04 + Math.random() * 0.09;
}
bonus.lastWasIntersecting = bIntersecting;
}
}
}; ===================================================================
--- original.js
+++ change.js
@@ -111,17 +111,17 @@
deco.orbitSpeed = sharedDecoOrbitSpeed;
decos.push(deco);
}
// Define orbits
-var orbits = [700, 900, 1100]; // Expanded bonus orbits to cover a much larger area
+var orbits = [140, 180, 220]; // Reduced bonus orbits, closer to center and equidistant
// Create three bonus objects, each occupying a unique orbit
var bonuses = [];
for (var i = 0; i < 3; i++) {
var b = game.addChild(new Bonus());
b.orbitIndex = i;
b.orbitRadius = orbits[i];
b.orbitSpeed = 0.04 + Math.random() * 0.09;
- b.orbitAngle = Math.random() * Math.PI * 2;
+ b.orbitAngle = Math.PI * 2 / 3 * i; // Equidistant angles
bonuses.push(b);
}
// Add a new fast-orbiting object (superBonus) that orbits faster than all bonuses
var superBonus = game.addChild(new Bonus());
Dead
Sound effect
MusicaInicio
Music
musica4
Music
musica1
Music
musica7
Music
musica10
Music
musica13
Music
musica16
Music
musica19
Music
musica22
Music
musica25
Music
musica28
Music
musica2
Music
musica3
Music
musica5
Music
musica6
Music
musica8
Music
musica9
Music
musica11
Music
musica12
Music
musica14
Music
musica15
Music
musica17
Music
musica18
Music
musica20
Music
musica21
Music
musica23
Music
musica24
Music
musica26
Music
musica27
Music
musica29
Music
musica30
Music