User prompt
que la banera se mas grand ey gorda
User prompt
que mejor el personaje slata cundo le de click ala pantalla ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
osea mas grandes los enemigos
User prompt
que el player tenga animacion para moverse ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
que sea ams grand eel player
User prompt
que las plataformas esten mas bajas
User prompt
que alla mas lento
User prompt
pero mejor queno salga eso de de nuevo que salga el game over normal
User prompt
pero que no siga la partida
User prompt
que el game over tenga diseño como de una moneda y que tenga un texto que ponga:de nuevo? y cuando el des se reinicie la partida
User prompt
mejor sin flecha sy que sea un runner
User prompt
que en la pantalla aya dos flechas una para moverse a la izquierda y otra a la derecha
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'addEventListener')' in or related to this line: 'leftControl.down = function (x, y, obj) {' Line Number: 369
User prompt
Please fix the bug: 'Cannot read properties of undefined (reading 'addEventListener')' in or related to this line: 'document.addEventListener('keydown', function (e) {' Line Number: 368
User prompt
y que con als flechas se mueva el personaje
User prompt
que el enemigo este ams lejos
User prompt
de plataformas
Code edit (1 edits merged)
Please save this source code
User prompt
Script Master - Text Adventure Creator
User prompt
scriipt
Initial prompt
un juego tipo mario bros 1
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
var Coin = Container.expand(function (startX, startY) {
var self = Container.call(this);
var coinGraphics = self.attachAsset('coin', {
anchorX: 0.5,
anchorY: 0.5
});
self.collected = false;
self.x = startX || 400;
self.y = startY || 2300;
self.update = function () {
if (!self.collected) {
self.rotation += 0.1;
}
};
self.collect = function () {
if (!self.collected) {
self.collected = true;
self.alpha = 0;
LK.setScore(LK.getScore() + 10);
LK.getSound('coin_collect').play();
}
};
return self;
});
var Enemy = Container.expand(function (startX, startY) {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 1
});
self.velocityX = -1;
self.velocityY = 0;
self.gravity = 0.5;
self.alive = true;
self.x = startX || 800;
self.y = startY || 2400;
self.update = function () {
if (!self.alive) return;
// Apply gravity
self.velocityY += self.gravity;
// Update position
self.x += self.velocityX;
self.y += self.velocityY;
// Ground collision
if (self.y >= 2400) {
self.y = 2400;
self.velocityY = 0;
}
// Platform collision
for (var i = 0; i < platforms.length; i++) {
var platform = platforms[i];
if (self.intersects(platform) && self.velocityY > 0) {
if (self.y - 25 <= platform.y - 20) {
self.y = platform.y - 20;
self.velocityY = 0;
break;
}
}
}
// Reverse direction at edges
if (self.x < 50 || self.x > levelWidth - 50) {
self.velocityX = -self.velocityX;
}
};
self.defeat = function () {
self.alive = false;
self.alpha = 0.5;
LK.getSound('enemy_hit').play();
LK.setTimeout(function () {
self.destroy();
}, 500);
};
return self;
});
var Platform = Container.expand(function (startX, startY, width) {
var self = Container.call(this);
self.platformWidth = width || 200;
var platformGraphics = self.attachAsset('platform', {
anchorX: 0.5,
anchorY: 0.5,
width: self.platformWidth
});
self.x = startX || 400;
self.y = startY || 2000;
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 1
});
self.velocityX = 0;
self.velocityY = 0;
self.gravity = 0.5;
self.jumpPower = -12;
self.speed = 4;
self.onGround = false;
self.lastOnGround = false;
self.x = 200;
self.y = 2400;
self.update = function () {
// Auto-move forward for runner game
self.velocityX = self.speed;
// Apply gravity
self.velocityY += self.gravity;
// Update position
self.x += self.velocityX;
self.y += self.velocityY;
// Ground collision
if (self.y >= 2400) {
self.y = 2400;
self.velocityY = 0;
self.onGround = true;
} else {
self.onGround = false;
}
// Platform collision
for (var i = 0; i < platforms.length; i++) {
var platform = platforms[i];
if (self.intersects(platform) && self.velocityY > 0) {
if (self.y - 40 <= platform.y - 20) {
self.y = platform.y - 20;
self.velocityY = 0;
self.onGround = true;
break;
}
}
}
// Update camera to follow player
cameraX = self.x - 1024;
if (cameraX < 0) cameraX = 0;
if (cameraX > levelWidth - 2048) cameraX = levelWidth - 2048;
self.lastOnGround = self.onGround;
};
self.jump = function () {
if (self.onGround) {
self.velocityY = self.jumpPower;
self.onGround = false;
LK.getSound('jump').play();
}
};
self.moveLeft = function () {
self.velocityX = -self.speed;
};
self.moveRight = function () {
self.velocityX = self.speed;
};
self.stop = function () {
self.velocityX = 0;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87ceeb
});
/****
* Game Code
****/
// Game variables
var levelWidth = 4000;
var cameraX = 0;
var platforms = [];
var enemies = [];
var coins = [];
var player = new Player();
var gameContainer = new Container();
// Touch controls - only jump for runner game
game.addChild(gameContainer);
gameContainer.addChild(player);
// Create ground
var ground = gameContainer.attachAsset('ground', {
x: 0,
y: 2460,
width: levelWidth,
anchorX: 0,
anchorY: 0
});
// Create platforms
var platformData = [{
x: 600,
y: 2300,
width: 200
}, {
x: 1000,
y: 2250,
width: 200
}, {
x: 1400,
y: 2200,
width: 200
}, {
x: 1800,
y: 2280,
width: 200
}, {
x: 2200,
y: 2240,
width: 200
}, {
x: 2600,
y: 2180,
width: 200
}, {
x: 3000,
y: 2150,
width: 200
}, {
x: 3400,
y: 2220,
width: 200
}];
for (var i = 0; i < platformData.length; i++) {
var platData = platformData[i];
var platform = new Platform(platData.x, platData.y, platData.width);
platforms.push(platform);
gameContainer.addChild(platform);
}
// Create enemies
var enemyData = [{
x: 900,
y: 2400
}, {
x: 1500,
y: 2400
}, {
x: 2300,
y: 2400
}, {
x: 3200,
y: 2400
}];
for (var i = 0; i < enemyData.length; i++) {
var enemyPos = enemyData[i];
var enemy = new Enemy(enemyPos.x, enemyPos.y);
enemies.push(enemy);
gameContainer.addChild(enemy);
}
// Create coins
var coinData = [{
x: 400,
y: 2350
}, {
x: 700,
y: 2250
}, {
x: 1100,
y: 2200
}, {
x: 1500,
y: 2150
}, {
x: 1900,
y: 2230
}, {
x: 2300,
y: 2190
}, {
x: 2700,
y: 2130
}, {
x: 3100,
y: 2100
}, {
x: 3500,
y: 2170
}];
for (var i = 0; i < coinData.length; i++) {
var coinPos = coinData[i];
var coin = new Coin(coinPos.x, coinPos.y);
coins.push(coin);
gameContainer.addChild(coin);
}
// Create finish flag
var flag = gameContainer.attachAsset('flag', {
x: 3800,
y: 2340,
anchorX: 0.5,
anchorY: 1
});
// Create UI
var scoreText = new Text2('Score: 0', {
size: 48,
fill: '#ffffff'
});
scoreText.anchor.set(0, 0);
scoreText.x = 50;
scoreText.y = 50;
LK.gui.topLeft.addChild(scoreText);
var instructionText = new Text2('Tap JUMP to jump! Avoid enemies and collect coins!', {
size: 32,
fill: '#ffffff'
});
instructionText.anchor.set(0.5, 0);
instructionText.x = 1024;
instructionText.y = 100;
LK.gui.top.addChild(instructionText);
// Control areas for mobile - only jump button for runner game
var jumpControl = new Container();
var jumpControlGraphics = jumpControl.attachAsset('platform', {
x: 1024,
y: 2500,
width: 300,
height: 150,
alpha: 0.3,
color: 0xff6600,
anchorX: 0.5,
anchorY: 0
});
game.addChild(jumpControl);
// Add jump button text
var jumpText = new Text2('JUMP', {
size: 40,
fill: '#ffffff'
});
jumpText.anchor.set(0.5, 0.5);
jumpText.x = 1024;
jumpText.y = 2575;
game.addChild(jumpText);
// Keyboard controls not supported in LK engine - using touch controls only
jumpControl.down = function (x, y, obj) {
player.jump();
};
game.update = function () {
// Update player (auto-running)
player.update();
// Update enemies
for (var i = enemies.length - 1; i >= 0; i--) {
var enemy = enemies[i];
enemy.update();
}
// Update coins
for (var i = 0; i < coins.length; i++) {
var coin = coins[i];
coin.update();
}
// Check collisions with enemies
for (var i = enemies.length - 1; i >= 0; i--) {
var enemy = enemies[i];
if (enemy.alive && player.intersects(enemy)) {
if (player.velocityY > 0 && player.y < enemy.y - 20) {
// Player jumped on enemy
enemy.defeat();
enemies.splice(i, 1);
player.velocityY = -10; // Bounce
LK.setScore(LK.getScore() + 50);
} else {
// Player hit enemy
LK.getSound('game_over').play();
LK.showGameOver();
return;
}
}
}
// Check collisions with coins
for (var i = coins.length - 1; i >= 0; i--) {
var coin = coins[i];
if (!coin.collected && player.intersects(coin)) {
coin.collect();
coins.splice(i, 1);
}
}
// Check if player reached flag
if (player.intersects(flag)) {
LK.showYouWin();
return;
}
// Check if player fell off screen
if (player.y > 2800) {
LK.getSound('game_over').play();
LK.showGameOver();
return;
}
// Update camera
gameContainer.x = -cameraX;
// Update score display
scoreText.setText('Score: ' + LK.getScore());
}; ===================================================================
--- original.js
+++ change.js
@@ -191,37 +191,37 @@
});
// Create platforms
var platformData = [{
x: 600,
- y: 2200,
+ y: 2300,
width: 200
}, {
x: 1000,
- y: 2000,
+ y: 2250,
width: 200
}, {
x: 1400,
- y: 1800,
+ y: 2200,
width: 200
}, {
x: 1800,
- y: 2100,
+ y: 2280,
width: 200
}, {
x: 2200,
- y: 1900,
+ y: 2240,
width: 200
}, {
x: 2600,
- y: 1700,
+ y: 2180,
width: 200
}, {
x: 3000,
- y: 1500,
+ y: 2150,
width: 200
}, {
x: 3400,
- y: 1800,
+ y: 2220,
width: 200
}];
for (var i = 0; i < platformData.length; i++) {
var platData = platformData[i];
@@ -251,33 +251,33 @@
}
// Create coins
var coinData = [{
x: 400,
- y: 2300
+ y: 2350
}, {
x: 700,
- y: 2100
+ y: 2250
}, {
x: 1100,
- y: 1900
+ y: 2200
}, {
x: 1500,
- y: 1700
+ y: 2150
}, {
x: 1900,
- y: 2000
+ y: 2230
}, {
x: 2300,
- y: 1800
+ y: 2190
}, {
x: 2700,
- y: 1600
+ y: 2130
}, {
x: 3100,
- y: 1400
+ y: 2100
}, {
x: 3500,
- y: 1700
+ y: 2170
}];
for (var i = 0; i < coinData.length; i++) {
var coinPos = coinData[i];
var coin = new Coin(coinPos.x, coinPos.y);