User prompt
separa un poco los obstaculos y mientras mas avances mas rapido valla el personaje ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
manten el tamaño pero reduce la hit box del obstaculo
User prompt
haz que el personaje pueda hacer un doble salto al clickear dos veces
Code edit (1 edits merged)
Please save this source code
User prompt
haz que el salto sea mas alto y el fondo sea un cielo con nubes que se mueve y el suelo sea futurista ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Code edit (1 edits merged)
Please save this source code
User prompt
Portal Worlds
Initial prompt
hola,un juego donde avanzas y saltas a travez de portales y al pasar por el portal cambia a otro mundo
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Cloud = Container.expand(function () {
var self = Container.call(this);
var cloudGraphics = self.attachAsset('cloud', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 1 + Math.random() * 2;
cloudGraphics.alpha = 0.6 + Math.random() * 0.3;
var scale = 0.5 + Math.random() * 1.5;
cloudGraphics.scaleX = scale;
cloudGraphics.scaleY = scale * 0.6;
self.update = function () {
self.x -= self.speed;
};
return self;
});
var Ground = Container.expand(function () {
var self = Container.call(this);
var groundGraphics = self.attachAsset('ground', {
anchorX: 0,
anchorY: 0
});
self.speed = gameSpeed;
self.update = function () {
self.x -= self.speed;
};
return self;
});
var Obstacle = Container.expand(function () {
var self = Container.call(this);
var obstacleGraphics = self.attachAsset('obstacle', {
anchorX: 0.5,
anchorY: 1
});
// Create smaller hitbox for collision detection (60% of original size)
self.hitbox = new Container();
self.hitbox.width = obstacleGraphics.width * 0.6;
self.hitbox.height = obstacleGraphics.height * 0.6;
self.hitbox.x = -self.hitbox.width * 0.5; // Center the hitbox
self.hitbox.y = -self.hitbox.height; // Align to bottom like the visual
self.addChild(self.hitbox);
// Override intersects method to use hitbox instead of full visual
self.intersects = function (other) {
return self.hitbox.intersects ? self.hitbox.intersects(other) : Container.prototype.intersects.call(self.hitbox, other);
};
self.speed = gameSpeed;
self.update = function () {
self.x -= self.speed;
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 1
});
self.velocityY = 0;
self.isOnGround = false;
self.jumpPower = -30;
self.gravity = 1.2;
self.jumpCount = 0;
self.maxJumps = 2;
self.jump = function () {
if (self.jumpCount < self.maxJumps) {
self.velocityY = self.jumpPower;
self.isOnGround = false;
self.jumpCount++;
LK.getSound('jump').play();
}
};
self.update = function () {
// Apply gravity
self.velocityY += self.gravity;
self.y += self.velocityY;
// Check ground collision
if (self.y >= groundY) {
self.y = groundY;
self.velocityY = 0;
self.isOnGround = true;
self.jumpCount = 0;
}
// Animate running
playerGraphics.rotation = Math.sin(LK.ticks * 0.3) * 0.1;
};
return self;
});
var Portal = Container.expand(function () {
var self = Container.call(this);
var portalGraphics = self.attachAsset('portal', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = gameSpeed;
self.used = false;
self.update = function () {
self.x -= self.speed;
// Portal animation
portalGraphics.rotation += 0.1;
portalGraphics.alpha = 0.7 + Math.sin(LK.ticks * 0.15) * 0.3;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game variables
var gameSpeed = 8;
var groundY = 2732 - 200;
var player;
var obstacles = [];
var portals = [];
var groundTiles = [];
var distance = 0;
var currentWorld = 0;
var worldTransitioning = false;
var clouds = [];
// World configurations
var worlds = [{
bg: 0x87CEEB,
ground: 0x4A90E2,
obstacle: 0xFF5722
},
// Sky world
{
bg: 0x1A237E,
ground: 0x424242,
obstacle: 0xFF9800
},
// Space world
{
bg: 0x006064,
ground: 0x00838F,
obstacle: 0x4CAF50
},
// Underwater world
{
bg: 0xFF6F00,
ground: 0xD84315,
obstacle: 0x795548
},
// Desert world
{
bg: 0xE3F2FD,
ground: 0x90A4AE,
obstacle: 0x607D8B
},
// Ice world
{
bg: 0x3E2723,
ground: 0xFF5722,
obstacle: 0x212121
} // Lava world
];
// UI
var distanceText = new Text2('Distance: 0', {
size: 60,
fill: 0xFFFFFF
});
distanceText.anchor.set(0, 0);
distanceText.x = 50;
distanceText.y = 50;
LK.gui.topLeft.addChild(distanceText);
var worldText = new Text2('Sky World', {
size: 50,
fill: 0xFFFFFF
});
worldText.anchor.set(0.5, 0);
LK.gui.top.addChild(worldText);
// Initialize player
player = game.addChild(new Player());
player.x = 300;
player.y = groundY;
// Initialize clouds
function createCloud() {
var cloud = new Cloud();
cloud.x = 2048 + Math.random() * 500;
cloud.y = 200 + Math.random() * 800;
return cloud;
}
// Create initial clouds
for (var i = 0; i < 8; i++) {
var cloud = game.addChild(createCloud());
clouds.push(cloud);
}
// Initialize ground tiles
function createGroundTile(x) {
var tile = new Ground();
tile.x = x;
tile.y = groundY;
// Set speed based on current game progress
var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
tile.speed = gameSpeed * speedMultiplier;
applyWorldTheme(tile, currentWorld);
return tile;
}
function applyWorldTheme(object, worldIndex) {
var world = worlds[worldIndex];
if (object.children && object.children[0]) {
object.children[0].tint = world.ground;
}
}
// Create initial ground
for (var i = 0; i < 4; i++) {
var tile = game.addChild(createGroundTile(i * 2048));
groundTiles.push(tile);
}
// Obstacle spawning
var obstacleTimer = 0;
var portalTimer = 0;
function spawnObstacle() {
var obstacle = new Obstacle();
obstacle.x = 2048 + 100;
obstacle.y = groundY;
// Apply world theme
if (obstacle.children && obstacle.children[0]) {
obstacle.children[0].tint = worlds[currentWorld].obstacle;
}
// Set speed based on current game progress
var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
obstacle.speed = gameSpeed * speedMultiplier;
obstacles.push(obstacle);
game.addChild(obstacle);
}
function spawnPortal() {
var portal = new Portal();
portal.x = 2048 + 200;
portal.y = groundY - 100;
// Set speed based on current game progress
var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
portal.speed = gameSpeed * speedMultiplier;
portals.push(portal);
game.addChild(portal);
}
function changeWorld() {
if (worldTransitioning) {
return;
}
worldTransitioning = true;
currentWorld = (currentWorld + 1) % worlds.length;
// Flash effect
LK.effects.flashScreen(0xFFFFFF, 500);
// Update background
game.setBackgroundColor(worlds[currentWorld].bg);
// Update world text
var worldNames = ['Sky World', 'Space World', 'Underwater World', 'Desert World', 'Ice World', 'Lava World'];
worldText.setText(worldNames[currentWorld]);
// Update existing objects
for (var i = 0; i < groundTiles.length; i++) {
applyWorldTheme(groundTiles[i], currentWorld);
}
for (var i = 0; i < obstacles.length; i++) {
if (obstacles[i].children && obstacles[i].children[0]) {
obstacles[i].children[0].tint = worlds[currentWorld].obstacle;
}
}
LK.getSound('portal').play();
LK.setTimeout(function () {
worldTransitioning = false;
}, 500);
}
// Input handling
game.down = function (x, y, obj) {
player.jump();
};
// Main game loop
game.update = function () {
// Update distance
distance += gameSpeed;
distanceText.setText('Distance: ' + Math.floor(distance / 10));
LK.setScore(Math.floor(distance / 10));
// Spawn obstacles
obstacleTimer++;
if (obstacleTimer > 150 + Math.random() * 100) {
spawnObstacle();
obstacleTimer = 0;
}
// Spawn portals
portalTimer++;
if (portalTimer > 300 + Math.random() * 200) {
spawnPortal();
portalTimer = 0;
}
// Update and remove off-screen obstacles
for (var i = obstacles.length - 1; i >= 0; i--) {
var obstacle = obstacles[i];
if (obstacle.x < -100) {
obstacle.destroy();
obstacles.splice(i, 1);
continue;
}
// Collision detection
if (player.intersects(obstacle)) {
LK.getSound('crash').play();
LK.effects.flashScreen(0xFF0000, 1000);
LK.showGameOver();
return;
}
}
// Update and remove off-screen portals
for (var i = portals.length - 1; i >= 0; i--) {
var portal = portals[i];
if (portal.x < -150) {
portal.destroy();
portals.splice(i, 1);
continue;
}
// Portal collision
if (player.intersects(portal) && !portal.used) {
portal.used = true;
changeWorld();
LK.setScore(LK.getScore() + 10);
}
}
// Update ground tiles
for (var i = groundTiles.length - 1; i >= 0; i--) {
var tile = groundTiles[i];
if (tile.x < -2048) {
// Move tile to the right
tile.x = tile.x + groundTiles.length * 2048;
applyWorldTheme(tile, currentWorld);
}
}
// Check if player fell off screen
if (player.y > 2732 + 100) {
LK.getSound('crash').play();
LK.showGameOver();
return;
}
// Update clouds
for (var i = clouds.length - 1; i >= 0; i--) {
var cloud = clouds[i];
if (cloud.x < -300) {
cloud.destroy();
clouds.splice(i, 1);
// Spawn new cloud
var newCloud = game.addChild(createCloud());
clouds.push(newCloud);
}
}
// Gradually increase difficulty and speed based on distance
var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
var currentGameSpeed = gameSpeed * speedMultiplier;
if (LK.ticks % 600 === 0) {
gameSpeed += 0.5;
}
// Update speeds for existing objects with current speed multiplier
for (var i = 0; i < obstacles.length; i++) {
obstacles[i].speed = currentGameSpeed;
}
for (var i = 0; i < portals.length; i++) {
portals[i].speed = currentGameSpeed;
}
for (var i = 0; i < groundTiles.length; i++) {
groundTiles[i].speed = currentGameSpeed;
}
for (var i = 0; i < clouds.length; i++) {
clouds[i].speed = (1 + Math.random() * 2) * speedMultiplier;
}
}; ===================================================================
--- original.js
+++ change.js
@@ -203,8 +203,11 @@
function createGroundTile(x) {
var tile = new Ground();
tile.x = x;
tile.y = groundY;
+ // Set speed based on current game progress
+ var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
+ tile.speed = gameSpeed * speedMultiplier;
applyWorldTheme(tile, currentWorld);
return tile;
}
function applyWorldTheme(object, worldIndex) {
@@ -228,15 +231,21 @@
// Apply world theme
if (obstacle.children && obstacle.children[0]) {
obstacle.children[0].tint = worlds[currentWorld].obstacle;
}
+ // Set speed based on current game progress
+ var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
+ obstacle.speed = gameSpeed * speedMultiplier;
obstacles.push(obstacle);
game.addChild(obstacle);
}
function spawnPortal() {
var portal = new Portal();
portal.x = 2048 + 200;
portal.y = groundY - 100;
+ // Set speed based on current game progress
+ var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
+ portal.speed = gameSpeed * speedMultiplier;
portals.push(portal);
game.addChild(portal);
}
function changeWorld() {
@@ -277,9 +286,9 @@
distanceText.setText('Distance: ' + Math.floor(distance / 10));
LK.setScore(Math.floor(distance / 10));
// Spawn obstacles
obstacleTimer++;
- if (obstacleTimer > 90 + Math.random() * 60) {
+ if (obstacleTimer > 150 + Math.random() * 100) {
spawnObstacle();
obstacleTimer = 0;
}
// Spawn portals
@@ -344,19 +353,24 @@
var newCloud = game.addChild(createCloud());
clouds.push(newCloud);
}
}
- // Gradually increase difficulty
+ // Gradually increase difficulty and speed based on distance
+ var speedMultiplier = 1 + Math.floor(distance / 1000) * 0.3;
+ var currentGameSpeed = gameSpeed * speedMultiplier;
if (LK.ticks % 600 === 0) {
gameSpeed += 0.5;
- // Update speeds for existing objects
- for (var i = 0; i < obstacles.length; i++) {
- obstacles[i].speed = gameSpeed;
- }
- for (var i = 0; i < portals.length; i++) {
- portals[i].speed = gameSpeed;
- }
- for (var i = 0; i < groundTiles.length; i++) {
- groundTiles[i].speed = gameSpeed;
- }
}
+ // Update speeds for existing objects with current speed multiplier
+ for (var i = 0; i < obstacles.length; i++) {
+ obstacles[i].speed = currentGameSpeed;
+ }
+ for (var i = 0; i < portals.length; i++) {
+ portals[i].speed = currentGameSpeed;
+ }
+ for (var i = 0; i < groundTiles.length; i++) {
+ groundTiles[i].speed = currentGameSpeed;
+ }
+ for (var i = 0; i < clouds.length; i++) {
+ clouds[i].speed = (1 + Math.random() * 2) * speedMultiplier;
+ }
};
\ No newline at end of file
portal con manos saliendo de el. In-Game asset. 2d. High contrast. No shadows
piso futurista. In-Game asset. 2d. High contrast. No shadows
modern player of app store icon,only player,in skaetborg. In-Game asset. 2d. High contrast. No shadows
only portal colorido. In-Game asset. 2d. High contrast. No shadows
nube. In-Game asset. 2d. High contrast. No shadows
planeta. In-Game asset. 2d. High contrast. No shadows
pez. In-Game asset. 2d. High contrast. No shadows
burbuja. In-Game asset. 2d. High contrast. No shadows
cohete con ojos y dientes afilados. In-Game asset. 2d. High contrast. No shadows
corazon. In-Game asset. 2d. High contrast. No shadows
sol. In-Game asset. 2d. High contrast. No shadows
bola rodante del desierto. In-Game asset. 2d. High contrast. No shadows
muñeco de nieve. In-Game asset. 2d. High contrast. No shadows
volcan. In-Game asset. 2d. High contrast. No shadows
bola de fuego. In-Game asset. 2d. High contrast. No shadows
icon modern alas. In-Game asset. 2d. High contrast. No shadows
esfera verde. In-Game asset. 2d. High contrast. No shadows
coin. In-Game asset. 2d. High contrast. No shadows
retro pixel ar style 80s
con ropa y pelo de mujer
dulces. In-Game asset. 2d. High contrast. No shadows
paleta. In-Game asset. 2d. High contrast. No shadows
hongo. In-Game asset. 2d. High contrast. No shadows
bus stop. In-Game asset. 2d. High contrast. No shadows
con una medusa en la cabeza y traje de buzo