User prompt
delete enemy box
User prompt
The distance between platforms should be clearer
User prompt
Set platforms so your character can jump
User prompt
Let the platforms be wide enough for us to jump between them
User prompt
Let there be more openness between platforms
User prompt
the game starts on the first platform
User prompt
can be dropped from the gaps between platforms
User prompt
make the spaces between the platforms larger
User prompt
The game consists of 50 platforms
User prompt
make platforms more complex
User prompt
Finally, let's jump into the coffee house and the game is over.
User prompt
The platforms should not be in the correct order, they should be up or down but the character should be able to jump.
User prompt
Build the platforms in the order of Mario
User prompt
enemy box follow player
User prompt
cloud and ground will not be the same create a new entity for ground
User prompt
make the ground below different, keep the platform the same
User prompt
Let the enemy box move towards the character and make the game harder
User prompt
enemy box can move up, down, right and left
User prompt
enemy box character follow
User prompt
make enemybox smarter
User prompt
The character reaches the coffee house at the end of the game
User prompt
Make the platforms large enough for your character to jump on
User prompt
game platforms randomly go away forever
User prompt
Don't make it orderly like a staircase, make it complicated
User prompt
delete enemy box
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ // Coin class var Coin = Container.expand(function () { var self = Container.call(this); var coinAsset = self.attachAsset('coinCircle', { anchorX: 0.5, anchorY: 0.5 }); self.width = coinAsset.width; self.height = coinAsset.height; return self; }); // Ground class (uses a unique asset for the ground) var Ground = Container.expand(function () { var self = Container.call(this); var groundAsset = self.attachAsset('groundBox', { anchorX: 0, anchorY: 0 }); self.width = groundAsset.width; self.height = groundAsset.height; return self; }); // Platform class var Platform = Container.expand(function () { var self = Container.call(this); var platAsset = self.attachAsset('platformBox', { anchorX: 0, anchorY: 0 }); self.width = platAsset.width; self.height = platAsset.height; return self; }); // Player character class var Player = Container.expand(function () { var self = Container.call(this); // Attach player asset (red box) var playerAsset = self.attachAsset('playerBox', { anchorX: 0.5, anchorY: 1 }); // Physics properties self.vx = 0; self.vy = 0; self.isOnGround = false; self.width = playerAsset.width; self.height = playerAsset.height; // For jump control self.jumpRequested = false; // Touch down on player (for jump) self.down = function (x, y, obj) { // Only allow jump if on ground if (self.isOnGround) { self.jumpRequested = true; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87ceeb // Sky blue }); /**** * Game Code ****/ // Sun and cloud assets (example IDs, replace with real asset IDs as needed) // --- Asset Initialization (shapes) --- // Tween for animations (jump, enemy movement, etc) // --- Game Variables --- var GRAVITY = 2.2; var JUMP_VELOCITY = -54; var PLAYER_SPEED = 16; var SCROLL_SPEED = 10; var LEVEL_LENGTH = 2048 * 3; // 3 screens wide var player; var platforms = []; var coins = []; var coffeeHouse = null; var cameraX = 0; var score = 0; var distance = 0; var gameOver = false; // --- GUI --- var scoreTxt = new Text2('0', { size: 100, fill: 0xFFF700 }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); var distTxt = new Text2('0m', { size: 60, fill: 0xFFFFFF }); distTxt.anchor.set(0.5, 0); LK.gui.top.addChild(distTxt); distTxt.y = 110; // --- Level Generation --- function createLevel() { // Clear old for (var i = 0; i < platforms.length; i++) platforms[i].destroy(); for (var i = 0; i < coins.length; i++) coins[i].destroy(); if (typeof coffeeHouse !== "undefined" && coffeeHouse) coffeeHouse.destroy(); platforms = []; coins = []; coffeeHouse = null; // Add sun to the sky var sun = LK.getAsset('sun', { anchorX: 0.5, anchorY: 0.5 }); sun.x = 300; sun.y = 300; game.addChild(sun); // Add a few clouds at different positions var cloud1 = LK.getAsset('cloud', { anchorX: 0.5, anchorY: 0.5 }); cloud1.x = 700; cloud1.y = 400; game.addChild(cloud1); var cloud2 = LK.getAsset('cloud', { anchorX: 0.5, anchorY: 0.5 }); cloud2.x = 1400; cloud2.y = 600; game.addChild(cloud2); var cloud3 = LK.getAsset('cloud', { anchorX: 0.5, anchorY: 0.5 }); cloud3.x = 2000; cloud3.y = 350; game.addChild(cloud3); // Ground platform for (var i = 0; i < LEVEL_LENGTH; i += 400) { var ground = new Ground(); ground.x = i; ground.y = 2300; platforms.push(ground); game.addChild(ground); } // Platform layout: up/down, not fixed order, player can jump between them var numPlatforms = 50; var platSpacingX = 700; // Increased spacing for clearer distance var platMinY = 900; var platMaxY = 1800; var lastY = 1800; for (var i = 0; i < numPlatforms; i++) { var plat = new Platform(); plat.x = 600 + i * platSpacingX; // Alternate up/down, but keep within jumpable range if (i === 0) { plat.y = lastY; } else { // Randomly go up or down, but clamp to min/max var deltaY = (Math.random() > 0.5 ? -1 : 1) * (320 + Math.floor(Math.random() * 180)); // Increased min gap plat.y = lastY + deltaY; if (plat.y < platMinY) plat.y = platMinY; if (plat.y > platMaxY) plat.y = platMaxY; lastY = plat.y; } platforms.push(plat); game.addChild(plat); // Place a coin above every platform var coin = new Coin(); coin.x = plat.x + plat.width / 2; coin.y = plat.y - 80; coins.push(coin); game.addChild(coin); } // Add coffee house at end of level coffeeHouse = LK.getAsset('coffeeHouse', { anchorX: 0.5, anchorY: 1 }); coffeeHouse.x = LEVEL_LENGTH - 200; coffeeHouse.y = 2300; game.addChild(coffeeHouse); } // --- Player Initialization --- function resetPlayer() { if (player) player.destroy(); player = new Player(); player.x = 200; player.y = 2200; player.vx = 0; player.vy = 0; player.isOnGround = false; game.addChild(player); } // --- Camera --- function updateCamera() { // Camera follows player, but clamps to level bounds cameraX = player.x - 600; if (cameraX < 0) cameraX = 0; if (cameraX > LEVEL_LENGTH - 2048) cameraX = LEVEL_LENGTH - 2048; // Move all game objects (except GUI) by -cameraX for (var i = 0; i < platforms.length; i++) platforms[i].xScreen = platforms[i].x - cameraX; for (var i = 0; i < coins.length; i++) coins[i].xScreen = coins[i].x - cameraX; player.xScreen = player.x - cameraX; } // --- Utility: AABB collision --- function intersectsAABB(a, b) { return a.x < b.x + b.width && a.x + a.width > b.x && a.y < b.y + b.height && a.y + a.height > b.y; } // --- Touch Controls --- // Touch controls: tap anywhere to jump, hold left/right for movement var moveDir = 0; // -1 = left, 1 = right, 0 = none game.down = function (x, y, obj) { if (gameOver) return; // Convert to game coordinates var gx = x + cameraX; // Always allow jump on tap down, anywhere if (player.isOnGround) { player.jumpRequested = true; } // Hold left/right for movement if (x < 2048 / 2) { moveDir = -1; } else { moveDir = 1; } }; game.up = function (x, y, obj) { moveDir = 0; }; game.move = function (x, y, obj) { // Allow drag to change direction if (x < 2048 / 2) { moveDir = -1; } else { moveDir = 1; } }; // --- Game Update Loop --- game.update = function () { if (gameOver) return; // --- Player Movement --- // Horizontal movement player.vx = moveDir * PLAYER_SPEED; // Apply gravity player.vy += GRAVITY; // Jump if (player.jumpRequested) { player.vy = JUMP_VELOCITY; player.jumpRequested = false; player.isOnGround = false; } // Move horizontally, check collisions player.x += player.vx; var collidedX = false; for (var i = 0; i < platforms.length; i++) { var plat = platforms[i]; if (intersectsAABB({ x: player.x - player.width / 2, y: player.y - player.height, width: player.width, height: player.height }, { x: plat.x, y: plat.y, width: plat.width, height: plat.height })) { // Collided horizontally, push player out if (player.vx > 0) { player.x = plat.x - player.width / 2; } else if (player.vx < 0) { player.x = plat.x + plat.width + player.width / 2; } collidedX = true; } } // Move vertically, check collisions player.y += player.vy; var collidedY = false; player.isOnGround = false; for (var i = 0; i < platforms.length; i++) { var plat = platforms[i]; if (intersectsAABB({ x: player.x - player.width / 2, y: player.y - player.height, width: player.width, height: player.height }, { x: plat.x, y: plat.y, width: plat.width, height: plat.height })) { // Collided vertically if (player.vy > 0) { // Falling, land on platform player.y = plat.y; player.vy = 0; player.isOnGround = true; } else if (player.vy < 0) { // Hitting head player.y = plat.y + plat.height + player.height; player.vy = 0; } collidedY = true; } } // --- Coin Collection --- for (var i = coins.length - 1; i >= 0; i--) { var coin = coins[i]; if (intersectsAABB({ x: player.x - player.width / 2, y: player.y - player.height, width: player.width, height: player.height }, { x: coin.x - coin.width / 2, y: coin.y - coin.height / 2, width: coin.width, height: coin.height })) { // Collect coin score += 1; scoreTxt.setText(score); coin.destroy(); coins.splice(i, 1); } } // --- Enemy Update & Collision --- // (Removed: No enemies in this version) // --- Camera & Distance --- updateCamera(); // Move all objects to screen position for (var i = 0; i < platforms.length; i++) { platforms[i].x = platforms[i].xScreen; } for (var i = 0; i < coins.length; i++) { coins[i].x = coins[i].xScreen; } player.x = player.xScreen; // --- Distance --- distance = Math.floor((player.x + cameraX) / 10); distTxt.setText(distance + "m"); // --- Win/Lose Conditions --- // Fall off screen if (player.y > 2732) { LK.effects.flashScreen(0xff0000, 1000); gameOver = true; LK.showGameOver(); return; } // Reached coffee house (win condition) if (coffeeHouse && intersectsAABB({ x: player.x - player.width / 2, y: player.y - player.height, width: player.width, height: player.height }, { x: coffeeHouse.x - coffeeHouse.width / 2, y: coffeeHouse.y - coffeeHouse.height, width: coffeeHouse.width, height: coffeeHouse.height })) { LK.effects.flashScreen(0x00ff00, 1000); LK.setScore(score); LK.showYouWin(); gameOver = true; return; } }; // --- Game Start --- function startGame() { score = 0; distance = 0; gameOver = false; scoreTxt.setText(score); distTxt.setText(distance + "m"); createLevel(); resetPlayer(); cameraX = 0; moveDir = 0; } // --- Start --- startGame();
===================================================================
--- original.js
+++ change.js
@@ -16,64 +16,8 @@
self.width = coinAsset.width;
self.height = coinAsset.height;
return self;
});
-// Enemy class (follows player in all four directions)
-var Enemy = Container.expand(function () {
- var self = Container.call(this);
- var enemyAsset = self.attachAsset('enemyBox', {
- anchorX: 0.5,
- anchorY: 1
- });
- self.width = enemyAsset.width;
- self.height = enemyAsset.height;
- // Movement direction: -1, 0, 1 for x and y
- self.dirX = 1;
- self.dirY = 0;
- self.speed = 3;
- // Movement bounds (set externally)
- self.leftBound = 0;
- self.rightBound = 2048;
- self.topBound = 0;
- self.bottomBound = 2300; // Don't go below ground
- self.update = function () {
- if (typeof player !== "undefined" && player) {
- // Always follow player horizontally
- if (Math.abs(player.x - self.x) > 10) {
- self.dirX = player.x > self.x ? 1 : -1;
- } else {
- self.dirX = 0;
- }
- // Always follow player vertically
- if (Math.abs(player.y - self.y) > 10) {
- self.dirY = player.y > self.y ? 1 : -1;
- } else {
- self.dirY = 0;
- }
- }
- // Move enemy
- self.x += self.dirX * self.speed;
- self.y += self.dirY * self.speed;
- // Clamp to movement bounds
- if (self.x < self.leftBound) {
- self.x = self.leftBound;
- self.dirX = 1;
- }
- if (self.x > self.rightBound) {
- self.x = self.rightBound;
- self.dirX = -1;
- }
- if (self.y < self.topBound) {
- self.y = self.topBound;
- self.dirY = 1;
- }
- if (self.y > self.bottomBound) {
- self.y = self.bottomBound;
- self.dirY = -1;
- }
- };
- return self;
-});
// Ground class (uses a unique asset for the ground)
var Ground = Container.expand(function () {
var self = Container.call(this);
var groundAsset = self.attachAsset('groundBox', {
@@ -142,9 +86,8 @@
var LEVEL_LENGTH = 2048 * 3; // 3 screens wide
var player;
var platforms = [];
var coins = [];
-var enemies = [];
var coffeeHouse = null;
var cameraX = 0;
var score = 0;
var distance = 0;
@@ -167,13 +110,11 @@
function createLevel() {
// Clear old
for (var i = 0; i < platforms.length; i++) platforms[i].destroy();
for (var i = 0; i < coins.length; i++) coins[i].destroy();
- for (var i = 0; i < enemies.length; i++) enemies[i].destroy();
if (typeof coffeeHouse !== "undefined" && coffeeHouse) coffeeHouse.destroy();
platforms = [];
coins = [];
- enemies = [];
coffeeHouse = null;
// Add sun to the sky
var sun = LK.getAsset('sun', {
anchorX: 0.5,
@@ -239,18 +180,8 @@
coin.x = plat.x + plat.width / 2;
coin.y = plat.y - 80;
coins.push(coin);
game.addChild(coin);
- // Place an enemy on every 3rd platform
- if (i % 3 === 2) {
- var enemy = new Enemy();
- enemy.x = plat.x + plat.width / 2;
- enemy.y = plat.y;
- enemy.leftBound = plat.x + 20;
- enemy.rightBound = plat.x + plat.width - 20;
- enemies.push(enemy);
- game.addChild(enemy);
- }
}
// Add coffee house at end of level
coffeeHouse = LK.getAsset('coffeeHouse', {
anchorX: 0.5,
@@ -279,9 +210,8 @@
if (cameraX > LEVEL_LENGTH - 2048) cameraX = LEVEL_LENGTH - 2048;
// Move all game objects (except GUI) by -cameraX
for (var i = 0; i < platforms.length; i++) platforms[i].xScreen = platforms[i].x - cameraX;
for (var i = 0; i < coins.length; i++) coins[i].xScreen = coins[i].x - cameraX;
- for (var i = 0; i < enemies.length; i++) enemies[i].xScreen = enemies[i].x - cameraX;
player.xScreen = player.x - cameraX;
}
// --- Utility: AABB collision ---
function intersectsAABB(a, b) {
@@ -407,29 +337,9 @@
coins.splice(i, 1);
}
}
// --- Enemy Update & Collision ---
- for (var i = 0; i < enemies.length; i++) {
- enemies[i].update();
- // Check collision with player
- if (intersectsAABB({
- x: player.x - player.width / 2,
- y: player.y - player.height,
- width: player.width,
- height: player.height
- }, {
- x: enemies[i].x - enemies[i].width / 2,
- y: enemies[i].y - enemies[i].height,
- width: enemies[i].width,
- height: enemies[i].height
- })) {
- // Game over
- LK.effects.flashScreen(0xff0000, 1000);
- gameOver = true;
- LK.showGameOver();
- return;
- }
- }
+ // (Removed: No enemies in this version)
// --- Camera & Distance ---
updateCamera();
// Move all objects to screen position
for (var i = 0; i < platforms.length; i++) {
@@ -437,11 +347,8 @@
}
for (var i = 0; i < coins.length; i++) {
coins[i].x = coins[i].xScreen;
}
- for (var i = 0; i < enemies.length; i++) {
- enemies[i].x = enemies[i].xScreen;
- }
player.x = player.xScreen;
// --- Distance ---
distance = Math.floor((player.x + cameraX) / 10);
distTxt.setText(distance + "m");
cloud. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
sun. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
çay bardağı. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
a kebap. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
baba terliği. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
starbucks kahvesi ama kızgın ve canlı. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
geleneksel türk kıraathanesi. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
starbucks kahvesi ama kaslı ve kıravartı olan sinirli bir starbucks kahvesi. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
180 derece stabucks kahvesi . No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
kırmızı ok. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
okun ucu sola baksın ve hiçbirşey değişmesin
şimdi ok yine değişmesin sadece ucu sağa baksın
şiş in içine geçmiş bir şekilde play yazıcak ama domates biber ve etten yani gerçek kebab gibi ama harfler var. daha çizgifilmsel olacak mesela "p" et "l" biber "a" domates "y" et
"Kebab Runner" yaz ama 1 şiş kebab yazının üstünde duracak olacak yani oyunun
çaydanlık adam. No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat
buzlu bir americano ama stabucks kahvesi çevresi beyaz olsun içinde çok buz olsun No background. Transparent background. Blank background. No shadows. 2d. In-Game asset. flat