User prompt
Puedes poner un marcador de máximo puntuaje ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
Puedes repetir en bucle la musica
User prompt
Puedes hacer el cocodrilo un poco más rapido
User prompt
Puedes hacer que el cocodrilo tenga la misma velocidad todo el tiempo
User prompt
Puedes hacer que mientras más puntos tengas más rápido irá el juego
User prompt
Puedes cambiar el color de puntaje de amarillo a blanco
User prompt
Puedes cambiar de color las letras
User prompt
Podrías hacer las letras más grandes
User prompt
Puede volver a su anterior nombre y hacer las letras más gruesas
User prompt
Puedes cambiar las letras del menu
User prompt
Puedes cambiar el fondo a en la parte de abajo tener agua y en la parte de arriba como un bosque
User prompt
Puedes hacer más grandes las bombas y las sandias
User prompt
Puedes hacer más grande la bomba
User prompt
Puedes hacer más rápido el juego
User prompt
Puedes hacer más grande el cocodrilo
User prompt
Puedes hacer visible en el menú el botón de tocar para jugar
User prompt
Podrías en el menú quitar el botón de pausar
User prompt
Please fix the bug: 'undefined is not an object (evaluating 'tween.easing.inOutSine')' in or related to this line: 'tween.to(startButton, {' Line Number: 103 ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Podrías poner un menu
User prompt
Podrías hacer el cocodrilo más grande
User prompt
Podrías poner más bombas en la pantalla
User prompt
Podrias hacer la sandías y bombas más grandes ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Podrías aumentar un poco más la velocidad
Code edit (1 edits merged)
Please save this source code
User prompt
Cocodrilo Hambriento
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Bomb = Container.expand(function () {
var self = Container.call(this);
var bombGraphics = self.attachAsset('bomb', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 7;
self.update = function () {
self.y += self.speed;
};
return self;
});
var Crocodile = Container.expand(function () {
var self = Container.call(this);
var crocodileGraphics = self.attachAsset('crocodile', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 12;
return self;
});
var Watermelon = Container.expand(function () {
var self = Container.call(this);
var watermelonGraphics = self.attachAsset('watermelon', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 6;
self.update = function () {
self.y += self.speed;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
var crocodile;
var watermelons = [];
var bombs = [];
var dragNode = null;
var spawnTimer = 0;
var difficultyLevel = 1;
var baseSpawnRate = 90;
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
crocodile = game.addChild(new Crocodile());
crocodile.x = 2048 / 2;
crocodile.y = 2732 - 150;
function handleMove(x, y, obj) {
if (dragNode) {
dragNode.x = Math.max(100, Math.min(2048 - 100, x));
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
dragNode = crocodile;
handleMove(x, y, obj);
};
game.up = function (x, y, obj) {
dragNode = null;
};
function spawnWatermelon() {
var watermelon = new Watermelon();
watermelon.x = Math.random() * (2048 - 240) + 120;
watermelon.y = -60;
watermelon.lastY = watermelon.y;
watermelon.lastIntersecting = false;
watermelons.push(watermelon);
game.addChild(watermelon);
}
function spawnBomb() {
var bomb = new Bomb();
bomb.x = Math.random() * (2048 - 200) + 100;
bomb.y = -50;
bomb.lastY = bomb.y;
bomb.lastIntersecting = false;
bombs.push(bomb);
game.addChild(bomb);
}
game.update = function () {
spawnTimer++;
difficultyLevel = Math.floor(LK.getScore() / 5) + 1;
var currentSpawnRate = Math.max(30, baseSpawnRate - difficultyLevel * 3);
if (spawnTimer >= currentSpawnRate) {
spawnTimer = 0;
if (Math.random() < 0.7) {
spawnWatermelon();
} else {
spawnBomb();
}
}
for (var i = watermelons.length - 1; i >= 0; i--) {
var watermelon = watermelons[i];
if (watermelon.lastY === undefined) watermelon.lastY = watermelon.y;
if (watermelon.lastIntersecting === undefined) watermelon.lastIntersecting = false;
if (watermelon.lastY < 2732 + 50 && watermelon.y >= 2732 + 50) {
watermelon.destroy();
watermelons.splice(i, 1);
continue;
}
var currentIntersecting = watermelon.intersects(crocodile);
if (!watermelon.lastIntersecting && currentIntersecting) {
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
LK.effects.flashObject(crocodile, 0x00FF00, 300);
LK.getSound('eat').play();
watermelon.destroy();
watermelons.splice(i, 1);
continue;
}
watermelon.lastY = watermelon.y;
watermelon.lastIntersecting = currentIntersecting;
}
for (var j = bombs.length - 1; j >= 0; j--) {
var bomb = bombs[j];
if (bomb.lastY === undefined) bomb.lastY = bomb.y;
if (bomb.lastIntersecting === undefined) bomb.lastIntersecting = false;
if (bomb.lastY < 2732 + 50 && bomb.y >= 2732 + 50) {
bomb.destroy();
bombs.splice(j, 1);
continue;
}
var currentIntersecting = bomb.intersects(crocodile);
if (!bomb.lastIntersecting && currentIntersecting) {
LK.effects.flashScreen(0xFF0000, 1000);
LK.getSound('explode').play();
LK.showGameOver();
return;
}
bomb.lastY = bomb.y;
bomb.lastIntersecting = currentIntersecting;
}
for (var w = 0; w < watermelons.length; w++) {
watermelons[w].speed = 6 + difficultyLevel * 0.8;
}
for (var b = 0; b < bombs.length; b++) {
bombs[b].speed = 7 + difficultyLevel * 0.8;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -80,19 +80,19 @@
dragNode = null;
};
function spawnWatermelon() {
var watermelon = new Watermelon();
- watermelon.x = Math.random() * (2048 - 160) + 80;
- watermelon.y = -40;
+ watermelon.x = Math.random() * (2048 - 240) + 120;
+ watermelon.y = -60;
watermelon.lastY = watermelon.y;
watermelon.lastIntersecting = false;
watermelons.push(watermelon);
game.addChild(watermelon);
}
function spawnBomb() {
var bomb = new Bomb();
- bomb.x = Math.random() * (2048 - 140) + 70;
- bomb.y = -35;
+ bomb.x = Math.random() * (2048 - 200) + 100;
+ bomb.y = -50;
bomb.lastY = bomb.y;
bomb.lastIntersecting = false;
bombs.push(bomb);
game.addChild(bomb);