User prompt
birinci bölümün tamamına platform ekle platformların arasına çok az daha boşluk ekle
User prompt
1. bölümdeki platform sayısını çoğal kalan bölümlerdekileri yarısına indir
User prompt
tüm platformların yakınlığı zıplama mesafesini geçmesin ve yarısıda olmasın
User prompt
bir tık daha uzağa atlayalım ve platformlar asla birleşmesin
User prompt
platformların arasındaki boşluğu daha çok arttır bölümlerde her yere platformları ekle
User prompt
platformları ve paraları yükselt ve aradaki boşlukları arttır platformun üstündeyken alttaki düşmanları yok edemeyelim
User prompt
para almak için veya düşman yok etmek için platformların içinden geçmesin
User prompt
platformları ve paraları biraz yükselt
User prompt
zıplama mesefesini iki katı yap
User prompt
paralar alçalsın zıplama artsın
User prompt
platformlar daha aşağıda olsun ve aralarındaki mesafe azalsın zıplama bir bölü iki artsın
User prompt
1 kere tıklıyınca az 2 kere tıklıyınca çok zıpla hareketli bulut ekle ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
daha yükseğe zıplayalım ve oyuna 10 bölüm daha ekle
User prompt
Please fix the bug: 'TypeError: setTimeout is not a function' in or related to this line: 'setTimeout(function () {' Line Number: 108
Code edit (1 edits merged)
Please save this source code
User prompt
Super Mario Adventure
Initial prompt
super mario oyununu geliştirip yap
/****
* 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.5;
self.initialX = 0;
self.update = function () {
self.x += self.speed;
// Reset cloud position when it goes off screen
if (self.x < cameraX - 200) {
self.x = cameraX + 2248 + Math.random() * 500;
self.y = 500 + Math.random() * 800;
}
};
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.collect = function () {
if (!self.collected) {
self.collected = true;
LK.setScore(LK.getScore() + 50);
LK.getSound('coin_collect').play();
tween(self, {
scaleX: 2,
scaleY: 2,
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
self.destroy();
}
});
}
};
self.update = function () {
if (!self.collected) {
// Bobbing animation
self.bobOffset += 0.1;
self.y = self.initialY + Math.sin(self.bobOffset) * 10;
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 = -2;
self.direction = -1;
self.isDefeated = false;
self.defeat = function () {
if (!self.isDefeated) {
self.isDefeated = true;
LK.setScore(LK.getScore() + 100);
LK.getSound('enemy_defeat').play();
tween(self, {
scaleY: 0.2,
alpha: 0
}, {
duration: 300,
onFinish: function onFinish() {
self.destroy();
}
});
}
};
self.update = function () {
if (!self.isDefeated) {
self.x += self.speed * self.direction;
// Simple AI - turn around at edges or walls
if (self.x < cameraX - 200 || self.x > cameraX + 2248) {
self.direction *= -1;
}
}
};
return self;
});
var Flag = Container.expand(function () {
var self = Container.call(this);
var flagGraphics = self.attachAsset('flag', {
anchorX: 0.5,
anchorY: 1.0
});
self.reached = false;
self.reach = function () {
if (!self.reached) {
self.reached = true;
LK.setScore(LK.getScore() + 1000);
LK.effects.flashScreen(0x00ff00, 1000);
// Check if this is the final level
if (currentLevel >= maxLevels) {
LK.setTimeout(function () {
LK.showYouWin();
}, 1000);
} else {
// Advance to next level
LK.setTimeout(function () {
nextLevel();
}, 1000);
}
}
};
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
var playerGraphics = self.attachAsset('player', {
anchorX: 0.5,
anchorY: 1.0
});
self.velocityY = 0;
self.isGrounded = false;
self.isJumping = false;
self.jumpPower = -36; // Doubled jump power
self.highJumpPower = -56; // Doubled high jump power for double tap
self.gravity = 1.2;
self.speed = 4;
self.lives = 3;
self.isInvulnerable = false;
self.invulnerabilityTime = 0;
self.tapCount = 0;
self.lastTapTime = 0;
self.doubleTapWindow = 300; // 300ms window for double tap
self.jump = function () {
if (self.isGrounded && !self.isJumping) {
var currentTime = Date.now();
// Check if this is a double tap
if (currentTime - self.lastTapTime < self.doubleTapWindow) {
// Double tap - high jump
self.velocityY = self.highJumpPower;
self.tapCount = 0;
} else {
// Single tap - normal jump
self.velocityY = self.jumpPower;
self.tapCount = 1;
}
self.lastTapTime = currentTime;
self.isJumping = true;
self.isGrounded = false;
LK.getSound('jump').play();
}
};
self.takeDamage = function () {
if (!self.isInvulnerable) {
self.lives--;
self.isInvulnerable = true;
self.invulnerabilityTime = 120; // 2 seconds at 60fps
LK.effects.flashObject(self, 0xff0000, 500);
if (self.lives <= 0) {
LK.showGameOver();
}
}
};
self.update = function () {
// Handle invulnerability timer
if (self.isInvulnerable) {
self.invulnerabilityTime--;
if (self.invulnerabilityTime <= 0) {
self.isInvulnerable = false;
}
}
// Apply gravity
self.velocityY += self.gravity;
// Move player
self.x += self.speed;
self.y += self.velocityY;
// Ground collision (basic ground level)
if (self.y >= groundLevel) {
self.y = groundLevel;
self.velocityY = 0;
self.isGrounded = true;
self.isJumping = false;
}
// Platform collision
for (var i = 0; i < platforms.length; i++) {
var platform = platforms[i];
if (self.intersects(platform)) {
var playerBottom = self.y;
var playerTop = self.y - 80; // Player height is 80
var playerLeft = self.x - 40; // Player width is 80, so half is 40
var playerRight = self.x + 40;
var platformTop = platform.y - platform.height / 2;
var platformBottom = platform.y + platform.height / 2;
var platformLeft = platform.x - platform.width / 2;
var platformRight = platform.x + platform.width / 2;
// Landing on top of platform
if (self.velocityY > 0 && playerBottom > platformTop - 20 && playerBottom < platformTop + 20) {
self.y = platformTop;
self.velocityY = 0;
self.isGrounded = true;
self.isJumping = false;
}
// Hitting platform from below
else if (self.velocityY < 0 && playerTop < platformBottom + 20 && playerTop > platformBottom - 20) {
self.y = platformBottom + 80; // Push player down
self.velocityY = 0;
}
// Hitting platform from left side
else if (playerRight > platformLeft && playerLeft < platformLeft && self.x < platform.x) {
self.x = platformLeft - 40; // Push player to the left
}
// Hitting platform from right side
else if (playerLeft < platformRight && playerRight > platformRight && self.x > platform.x) {
self.x = platformRight + 40; // Push player to the right
}
}
}
// Death by falling
if (self.y > 2732 + 100) {
self.takeDamage();
self.x = cameraX + 100;
self.y = groundLevel - 200;
}
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB
});
/****
* Game Code
****/
// Game variables
var player;
var enemies = [];
var coins = [];
var platforms = [];
var clouds = [];
var flag;
var cameraX = 0;
var groundLevel = 2600;
var levelWidth = 8000;
var currentLevel = 1;
var maxLevels = 11;
// UI elements
var scoreText = new Text2('Score: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreText.anchor.set(0, 0);
LK.gui.topLeft.addChild(scoreText);
var livesText = new Text2('Lives: 3', {
size: 60,
fill: 0xFFFFFF
});
livesText.anchor.set(1, 0);
LK.gui.topRight.addChild(livesText);
var levelText = new Text2('Level: 1', {
size: 60,
fill: 0xFFFFFF
});
levelText.anchor.set(0.5, 0);
LK.gui.top.addChild(levelText);
// Create ground platforms
for (var i = 0; i < levelWidth / 200; i++) {
var groundPiece = LK.getAsset('ground', {
anchorX: 0.5,
anchorY: 1.0
});
groundPiece.x = i * 200 + 100;
groundPiece.y = groundLevel + 30;
game.addChild(groundPiece);
}
// Create player
player = game.addChild(new Player());
player.x = 200;
player.y = groundLevel;
// Create platforms
var platformPositions = [{
x: 600,
y: 2400
}, {
x: 900,
y: 2350
}, {
x: 1200,
y: 2380
}, {
x: 1500,
y: 2420
}, {
x: 1800,
y: 2360
}, {
x: 2100,
y: 2400
}, {
x: 2400,
y: 2370
}, {
x: 2700,
y: 2410
}, {
x: 3000,
y: 2390
}, {
x: 3300,
y: 2380
}];
for (var i = 0; i < platformPositions.length; i++) {
var platform = LK.getAsset('platform', {
anchorX: 0.5,
anchorY: 0.5
});
platform.x = platformPositions[i].x;
platform.y = platformPositions[i].y;
platforms.push(platform);
game.addChild(platform);
}
// Create enemies
var enemyPositions = [{
x: 1000,
y: groundLevel
}, {
x: 1600,
y: groundLevel
}, {
x: 2200,
y: groundLevel
}, {
x: 2800,
y: groundLevel
}, {
x: 3400,
y: groundLevel
}, {
x: 4000,
y: groundLevel
}, {
x: 4600,
y: groundLevel
}, {
x: 5200,
y: groundLevel
}, {
x: 5800,
y: groundLevel
}];
for (var i = 0; i < enemyPositions.length; i++) {
var enemy = game.addChild(new Enemy());
enemy.x = enemyPositions[i].x;
enemy.y = enemyPositions[i].y;
enemies.push(enemy);
}
// Create coins
var coinPositions = [{
x: 600,
y: 2300
}, {
x: 1000,
y: 2250
}, {
x: 1400,
y: 2200
}, {
x: 1900,
y: 2250
}, {
x: 2500,
y: 2150
}, {
x: 3100,
y: 2250
}, {
x: 3700,
y: 2200
}, {
x: 4300,
y: 2250
}, {
x: 4900,
y: 2150
}, {
x: 5500,
y: 2250
}, {
x: 6100,
y: 2200
}, {
x: 6500,
y: 2300
}, {
x: 6900,
y: 2250
}];
for (var i = 0; i < coinPositions.length; i++) {
var coin = game.addChild(new Coin());
coin.x = coinPositions[i].x;
coin.y = coinPositions[i].y;
coin.initialY = coin.y;
coins.push(coin);
}
// Create flag at the end
flag = game.addChild(new Flag());
flag.x = levelWidth - 200;
flag.y = groundLevel;
// Create moving clouds
for (var i = 0; i < 8; i++) {
var cloud = game.addChild(new Cloud());
cloud.x = Math.random() * levelWidth;
cloud.y = 300 + Math.random() * 1000;
cloud.initialX = cloud.x;
clouds.push(cloud);
// Add random tween movement for more dynamic clouds
tween(cloud, {
y: cloud.y + (Math.random() - 0.5) * 200
}, {
duration: 3000 + Math.random() * 2000,
easing: tween.easeInOut,
onFinish: function () {
// Start a new random movement
tween(this, {
y: this.y + (Math.random() - 0.5) * 300
}, {
duration: 3000 + Math.random() * 2000,
easing: tween.easeInOut
});
}.bind(cloud)
});
}
// Touch controls
game.down = function (x, y, obj) {
player.jump();
};
// Camera following
function updateCamera() {
// Camera follows player with some offset
var targetCameraX = player.x - 300;
// Clamp camera to level bounds
targetCameraX = Math.max(0, Math.min(targetCameraX, levelWidth - 2048));
// Smooth camera movement
cameraX += (targetCameraX - cameraX) * 0.1;
// Apply camera offset to all game objects
game.x = -cameraX;
}
// Game update loop
game.update = function () {
// Update camera
updateCamera();
// Update UI
scoreText.setText('Score: ' + LK.getScore());
livesText.setText('Lives: ' + player.lives);
levelText.setText('Level: ' + currentLevel);
// Check player-enemy collisions
for (var i = enemies.length - 1; i >= 0; i--) {
var enemy = enemies[i];
if (!enemy.isDefeated && player.intersects(enemy) && !player.isInvulnerable) {
// Check if player is jumping on enemy
if (player.velocityY > 0 && player.y < enemy.y - 20) {
// Player stomps enemy
enemy.defeat();
enemies.splice(i, 1);
player.velocityY = -15; // Small bounce
} else {
// Player takes damage
player.takeDamage();
}
}
}
// Check player-coin collisions
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 player-flag collision
if (!flag.reached && player.intersects(flag)) {
flag.reach();
}
};
// Function to advance to next level
function nextLevel() {
currentLevel++;
if (currentLevel > maxLevels) {
LK.showYouWin();
return;
}
// Clear current level objects
for (var i = enemies.length - 1; i >= 0; i--) {
enemies[i].destroy();
}
enemies = [];
for (var i = coins.length - 1; i >= 0; i--) {
coins[i].destroy();
}
coins = [];
for (var i = platforms.length - 1; i >= 0; i--) {
platforms[i].destroy();
}
platforms = [];
for (var i = clouds.length - 1; i >= 0; i--) {
clouds[i].destroy();
}
clouds = [];
flag.destroy();
// Generate new level with increased difficulty
generateLevel();
// Reset player position
player.x = 200;
player.y = groundLevel;
player.velocityY = 0;
cameraX = 0;
}
// Function to generate level based on current level
function generateLevel() {
var difficultyMultiplier = currentLevel * 0.3;
var platformCount = Math.min(15 + currentLevel * 2, 25);
var enemyCount = Math.min(10 + currentLevel, 20);
var coinCount = Math.min(15 + currentLevel * 2, 30);
// Create platforms with increasing complexity
for (var i = 0; i < platformCount; i++) {
var platform = LK.getAsset('platform', {
anchorX: 0.5,
anchorY: 0.5
});
platform.x = 600 + i * (levelWidth - 1200) / platformCount + (Math.random() - 0.5) * 150;
platform.y = 2400 - Math.random() * 100 - currentLevel * 10;
platforms.push(platform);
game.addChild(platform);
}
// Create enemies with increasing count
for (var i = 0; i < enemyCount; i++) {
var enemy = game.addChild(new Enemy());
enemy.x = 800 + i * (levelWidth - 1600) / enemyCount + (Math.random() - 0.5) * 200;
enemy.y = groundLevel;
enemy.speed = -2 - difficultyMultiplier;
enemies.push(enemy);
}
// Create coins
for (var i = 0; i < coinCount; i++) {
var coin = game.addChild(new Coin());
coin.x = 500 + i * (levelWidth - 1000) / coinCount + (Math.random() - 0.5) * 400;
coin.y = 2250 - Math.random() * 200;
coin.initialY = coin.y;
coins.push(coin);
}
// Create moving clouds
var cloudCount = 6 + Math.floor(currentLevel / 2);
for (var i = 0; i < cloudCount; i++) {
var cloud = game.addChild(new Cloud());
cloud.x = Math.random() * levelWidth;
cloud.y = 300 + Math.random() * 1000;
cloud.initialX = cloud.x;
clouds.push(cloud);
// Add random tween movement
tween(cloud, {
y: cloud.y + (Math.random() - 0.5) * 250
}, {
duration: 2500 + Math.random() * 2000,
easing: tween.easeInOut,
onFinish: function () {
tween(this, {
y: this.y + (Math.random() - 0.5) * 300
}, {
duration: 2500 + Math.random() * 2000,
easing: tween.easeInOut
});
}.bind(cloud)
});
}
// Create flag at the end
flag = game.addChild(new Flag());
flag.x = levelWidth - 200;
flag.y = groundLevel;
flag.reached = false;
}
// Start background music
LK.playMusic('background_music');
; ===================================================================
--- original.js
+++ change.js
@@ -194,17 +194,37 @@
}
// Platform collision
for (var i = 0; i < platforms.length; i++) {
var platform = platforms[i];
- if (self.intersects(platform) && self.velocityY > 0) {
+ if (self.intersects(platform)) {
var playerBottom = self.y;
+ var playerTop = self.y - 80; // Player height is 80
+ var playerLeft = self.x - 40; // Player width is 80, so half is 40
+ var playerRight = self.x + 40;
var platformTop = platform.y - platform.height / 2;
- if (playerBottom > platformTop - 20 && playerBottom < platformTop + 20) {
+ var platformBottom = platform.y + platform.height / 2;
+ var platformLeft = platform.x - platform.width / 2;
+ var platformRight = platform.x + platform.width / 2;
+ // Landing on top of platform
+ if (self.velocityY > 0 && playerBottom > platformTop - 20 && playerBottom < platformTop + 20) {
self.y = platformTop;
self.velocityY = 0;
self.isGrounded = true;
self.isJumping = false;
}
+ // Hitting platform from below
+ else if (self.velocityY < 0 && playerTop < platformBottom + 20 && playerTop > platformBottom - 20) {
+ self.y = platformBottom + 80; // Push player down
+ self.velocityY = 0;
+ }
+ // Hitting platform from left side
+ else if (playerRight > platformLeft && playerLeft < platformLeft && self.x < platform.x) {
+ self.x = platformLeft - 40; // Push player to the left
+ }
+ // Hitting platform from right side
+ else if (playerLeft < platformRight && playerRight > platformRight && self.x > platform.x) {
+ self.x = platformRight + 40; // Push player to the right
+ }
}
}
// Death by falling
if (self.y > 2732 + 100) {
Fullscreen modern App Store landscape banner, 16:9, high definition, for a game titled "Super Mario Adventure" and with the description "Classic side-scrolling platformer where you jump over obstacles, collect coins, and defeat enemies to reach the goal flag.". No text on banner!
düşman. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
çimenli zemin. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
coın. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
oyun geçiş kapısı. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat