User prompt
oyun adını galaxy destroyer olarak değiştir
User prompt
bu yaptığım oyunu sayfama kaydet ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
1 adet dönerek gelen uzay gemisi var onu kaldır
User prompt
gezengenler arka planda sadece birer adet görünsün
User prompt
arka plana gök cisimleri ekle örneğin gök taşı gibi
User prompt
düşman gemleri görüntüsünü güç_arttırma_hızlı_ateş adındaki görüntü ile değiştir
User prompt
ana karakterin görüntüsünü uzaygemisi adlı görüntü ile değiştir
User prompt
oyunun belirli noktalarında büyük boss düşman gelsin
User prompt
arka plana gezegenleride ekle onlarda yıldızlar gibi gidip gelsin
User prompt
oyunu kazanma score 100000 olsun
User prompt
her 250 score dan sonra +30 can veren can bonusları gelsin
User prompt
500 score dan sonra düman gemiler çok zorlu olmaya başlasın
User prompt
her 150 score dan sonra düşman gemilerin zorluk seviyesi artsın
User prompt
bonuslar hem ateş sayısını arttırsın hemde tek seferde ki ateş sayısınıda arttırsın
User prompt
uzay gemilerinin ateş gücünü arttıracak bonuslar olsun oyunda
User prompt
uzay gemileri daha hızlı ateş etsin
User prompt
uzay gemileri gerçek uzay gemisine benzesin
User prompt
bana uzay gemisi savaşı tarzı bir oyun yazabilirmisin
User prompt
başarılı olmadı her şeyi unut bana kafa topu oyununa benzer bir oyun yap
User prompt
başarılı olmadı tekrar denermisin ve harşta daha yüksek görselli olsun
Code edit (1 edits merged)
Please save this source code
User prompt
Super Jump Adventure
Initial prompt
bana süper mario benzeri 1 levellik bir oyun yaparmısın
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Ball = Container.expand(function () { var self = Container.call(this); var ballGraphics = self.attachAsset('ball', { anchorX: 0.5, anchorY: 0.5 }); var ballPattern = self.attachAsset('ball_pattern', { anchorX: 0.5, anchorY: 0.5 }); ballPattern.alpha = 0.3; self.velocityX = 0; self.velocityY = 0; self.gravity = 0.5; self.bounce = 0.8; self.friction = 0.95; self.inAir = false; self.lastY = 0; self.update = function () { self.lastY = self.y; // Apply gravity self.velocityY += self.gravity; // Apply movement self.x += self.velocityX; self.y += self.velocityY; // Ball rotation based on movement self.rotation += self.velocityX * 0.01; // Bounce off ground if (self.y >= 2600) { self.y = 2600; self.velocityY *= -self.bounce; self.velocityX *= self.friction; if (Math.abs(self.velocityY) < 2) { self.velocityY = 0; } LK.getSound('bounce').play(); } // Bounce off walls if (self.x <= 40 || self.x >= 2008) { self.velocityX *= -self.bounce; if (self.x <= 40) self.x = 40; if (self.x >= 2008) self.x = 2008; LK.getSound('bounce').play(); } // Check collision with player if (self.intersects(player)) { var dx = self.x - player.x; var dy = self.y - player.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 70) { // Calculate kick direction var kickForce = 15; self.velocityX = dx / distance * kickForce; self.velocityY = dy / distance * kickForce - 5; LK.getSound('kick').play(); } } // Check goal if (self.x >= 1800 && self.x <= 2000 && self.y >= 2400 && self.y <= 2600) { LK.setScore(LK.getScore() + 1); scoreTxt.setText(LK.getScore()); LK.getSound('goal').play(); self.reset(); } }; self.reset = function () { self.x = 1024; self.y = 2400; self.velocityX = 0; self.velocityY = 0; }; return self; }); var Goal = Container.expand(function () { var self = Container.call(this); var leftPost = self.attachAsset('goal_post', { anchorX: 0.5, anchorY: 1.0 }); leftPost.x = -75; leftPost.y = 0; var rightPost = self.attachAsset('goal_post', { anchorX: 0.5, anchorY: 1.0 }); rightPost.x = 75; rightPost.y = 0; var crossbar = self.attachAsset('goal_post', { anchorX: 0.5, anchorY: 0.5 }); crossbar.x = 0; crossbar.y = -200; crossbar.rotation = Math.PI / 2; var net = self.attachAsset('goal_net', { anchorX: 0.5, anchorY: 1.0 }); net.x = 0; net.y = -10; net.alpha = 0.3; return self; }); var Player = Container.expand(function () { var self = Container.call(this); var body = self.attachAsset('player_body', { anchorX: 0.5, anchorY: 1.0 }); var head = self.attachAsset('player_head', { anchorX: 0.5, anchorY: 0.5 }); head.y = -80; self.velocityX = 0; self.velocityY = 0; self.onGround = false; self.speed = 10; self.jumpPower = 18; self.gravity = 0.8; self.maxFallSpeed = 15; self.update = function () { // Apply gravity if (!self.onGround) { self.velocityY += self.gravity; if (self.velocityY > self.maxFallSpeed) { self.velocityY = self.maxFallSpeed; } } // Apply movement self.x += self.velocityX; self.y += self.velocityY; // Reset ground state self.onGround = false; // Check ground collision if (self.y >= 2600) { self.y = 2600; self.velocityY = 0; self.onGround = true; } // Keep player on screen if (self.x < 25) self.x = 25; if (self.x > 2023) self.x = 2023; // Apply friction self.velocityX *= 0.85; }; self.jump = function () { if (self.onGround) { self.velocityY = -self.jumpPower; self.onGround = false; } }; self.moveLeft = function () { self.velocityX = -self.speed; }; self.moveRight = function () { self.velocityX = self.speed; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x228b22 }); /**** * Game Code ****/ var groundLevel = 2600; var player; var ball; var goal; var scoreTxt; var timeTxt; var isDragging = false; var dragStartX = 0; var gameTime = 60; var gameTimer; // Create soccer field var field = LK.getAsset('field_grass', { anchorX: 0.5, anchorY: 1.0 }); field.x = 1024; field.y = groundLevel; game.addChild(field); // Create center line var centerLine = LK.getAsset('field_line', { anchorX: 0.5, anchorY: 0.5 }); centerLine.x = 1024; centerLine.y = groundLevel - 25; game.addChild(centerLine); // Create goal goal = new Goal(); goal.x = 1900; goal.y = groundLevel; game.addChild(goal); // Create player player = new Player(); player.x = 300; player.y = groundLevel; game.addChild(player); // Create ball ball = new Ball(); ball.x = 1024; ball.y = 2400; game.addChild(ball); // Create UI scoreTxt = new Text2('Goals: 0', { size: 60, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); scoreTxt.setText('Goals: ' + LK.getScore()); LK.gui.top.addChild(scoreTxt); timeTxt = new Text2('Time: 60', { size: 50, fill: 0xFFFFFF }); timeTxt.anchor.set(0, 0); timeTxt.x = 120; timeTxt.y = 20; LK.gui.topLeft.addChild(timeTxt); // Game timer gameTimer = LK.setInterval(function () { gameTime--; timeTxt.setText('Time: ' + gameTime); if (gameTime <= 0) { LK.clearInterval(gameTimer); if (LK.getScore() >= 5) { LK.showYouWin(); } else { LK.showGameOver(); } } }, 1000); // Touch controls game.down = function (x, y, obj) { isDragging = true; dragStartX = x; // Jump on tap if (y > 2000) { player.jump(); } }; game.move = function (x, y, obj) { if (isDragging) { var deltaX = x - dragStartX; if (deltaX > 5) { player.moveRight(); } else if (deltaX < -5) { player.moveLeft(); } dragStartX = x; } }; game.up = function (x, y, obj) { isDragging = false; }; game.update = function () { // Update score display scoreTxt.setText('Goals: ' + LK.getScore()); };
===================================================================
--- original.js
+++ change.js
@@ -5,194 +5,109 @@
/****
* Classes
****/
-var Coin = Container.expand(function () {
+var Ball = Container.expand(function () {
var self = Container.call(this);
- var outerRing = self.attachAsset('coin_outer', {
+ var ballGraphics = self.attachAsset('ball', {
anchorX: 0.5,
anchorY: 0.5
});
- var innerRing = self.attachAsset('coin_inner', {
+ var ballPattern = self.attachAsset('ball_pattern', {
anchorX: 0.5,
anchorY: 0.5
});
- var center = self.attachAsset('coin_center', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- self.collected = false;
+ ballPattern.alpha = 0.3;
+ self.velocityX = 0;
+ self.velocityY = 0;
+ self.gravity = 0.5;
+ self.bounce = 0.8;
+ self.friction = 0.95;
+ self.inAir = false;
+ self.lastY = 0;
self.update = function () {
- if (!self.collected) {
- self.rotation += 0.1;
- if (self.intersects(player)) {
- self.collect();
+ self.lastY = self.y;
+ // Apply gravity
+ self.velocityY += self.gravity;
+ // Apply movement
+ self.x += self.velocityX;
+ self.y += self.velocityY;
+ // Ball rotation based on movement
+ self.rotation += self.velocityX * 0.01;
+ // Bounce off ground
+ if (self.y >= 2600) {
+ self.y = 2600;
+ self.velocityY *= -self.bounce;
+ self.velocityX *= self.friction;
+ if (Math.abs(self.velocityY) < 2) {
+ self.velocityY = 0;
}
+ LK.getSound('bounce').play();
}
- };
- self.collect = function () {
- if (!self.collected) {
- self.collected = true;
- LK.setScore(LK.getScore() + 10);
- scoreTxt.setText(LK.getScore());
- LK.getSound('coin').play();
- // Create particle effect
- for (var i = 0; i < 8; i++) {
- var particle = new Particle();
- particle.x = self.x;
- particle.y = self.y;
- particles.push(particle);
- game.addChild(particle);
- }
- tween(self, {
- scaleX: 0,
- scaleY: 0,
- alpha: 0,
- rotation: Math.PI * 2
- }, {
- duration: 300,
- onFinish: function onFinish() {
- self.destroy();
- }
- });
+ // Bounce off walls
+ if (self.x <= 40 || self.x >= 2008) {
+ self.velocityX *= -self.bounce;
+ if (self.x <= 40) self.x = 40;
+ if (self.x >= 2008) self.x = 2008;
+ LK.getSound('bounce').play();
}
- };
- return self;
-});
-var Enemy = Container.expand(function () {
- var self = Container.call(this);
- var body = self.attachAsset('enemy_body', {
- anchorX: 0.5,
- anchorY: 1.0
- });
- var spikes = self.attachAsset('enemy_spikes', {
- anchorX: 0.5,
- anchorY: 1.0
- });
- spikes.y = -45;
- var leftEye = self.attachAsset('enemy_eyes', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- leftEye.x = -10;
- leftEye.y = -35;
- var rightEye = self.attachAsset('enemy_eyes', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- rightEye.x = 10;
- rightEye.y = -35;
- self.velocityX = -2;
- self.defeated = false;
- self.update = function () {
- if (!self.defeated) {
- self.x += self.velocityX;
- // Bounce off platforms
- if (self.x <= 100 || self.x >= 1948) {
- self.velocityX *= -1;
+ // Check collision with player
+ if (self.intersects(player)) {
+ var dx = self.x - player.x;
+ var dy = self.y - player.y;
+ var distance = Math.sqrt(dx * dx + dy * dy);
+ if (distance < 70) {
+ // Calculate kick direction
+ var kickForce = 15;
+ self.velocityX = dx / distance * kickForce;
+ self.velocityY = dy / distance * kickForce - 5;
+ LK.getSound('kick').play();
}
- if (self.intersects(player)) {
- if (player.velocityY > 0 && player.y < self.y - 20) {
- // Player jumped on enemy
- self.defeat();
- player.velocityY = -10; // Bounce player up
- } else {
- // Player touched enemy
- player.die();
- }
- }
}
- };
- self.defeat = function () {
- if (!self.defeated) {
- self.defeated = true;
- LK.setScore(LK.getScore() + 50);
+ // Check goal
+ if (self.x >= 1800 && self.x <= 2000 && self.y >= 2400 && self.y <= 2600) {
+ LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
- LK.getSound('enemy_defeat').play();
- tween(self, {
- scaleY: 0.1,
- alpha: 0
- }, {
- duration: 500,
- onFinish: function onFinish() {
- self.destroy();
- }
- });
+ LK.getSound('goal').play();
+ self.reset();
}
};
+ self.reset = function () {
+ self.x = 1024;
+ self.y = 2400;
+ self.velocityX = 0;
+ self.velocityY = 0;
+ };
return self;
});
-var Flag = Container.expand(function () {
+var Goal = Container.expand(function () {
var self = Container.call(this);
- var pole = self.attachAsset('flag_pole', {
+ var leftPost = self.attachAsset('goal_post', {
anchorX: 0.5,
anchorY: 1.0
});
- var cloth = self.attachAsset('flag_cloth', {
- anchorX: 0,
- anchorY: 0
- });
- cloth.x = 4;
- cloth.y = -110;
- var stripe1 = self.attachAsset('flag_stripe', {
- anchorX: 0,
- anchorY: 0
- });
- stripe1.x = 4;
- stripe1.y = -95;
- var stripe2 = self.attachAsset('flag_stripe', {
- anchorX: 0,
- anchorY: 0
- });
- stripe2.x = 4;
- stripe2.y = -80;
- self.animationTimer = 0;
- self.update = function () {
- // Flag waving animation
- self.animationTimer += 0.1;
- cloth.rotation = Math.sin(self.animationTimer) * 0.1;
- stripe1.rotation = Math.sin(self.animationTimer) * 0.1;
- stripe2.rotation = Math.sin(self.animationTimer) * 0.1;
- if (self.intersects(player)) {
- LK.setScore(LK.getScore() + 500);
- LK.showYouWin();
- }
- };
- return self;
-});
-var Particle = Container.expand(function () {
- var self = Container.call(this);
- var graphics = self.attachAsset('particle', {
+ leftPost.x = -75;
+ leftPost.y = 0;
+ var rightPost = self.attachAsset('goal_post', {
anchorX: 0.5,
- anchorY: 0.5
+ anchorY: 1.0
});
- self.velocityX = (Math.random() - 0.5) * 10;
- self.velocityY = (Math.random() - 0.5) * 10;
- self.life = 60;
- self.maxLife = 60;
- self.update = function () {
- self.x += self.velocityX;
- self.y += self.velocityY;
- self.velocityY += 0.3;
- self.life--;
- self.alpha = self.life / self.maxLife;
- if (self.life <= 0) {
- self.destroy();
- }
- };
- return self;
-});
-var Platform = Container.expand(function () {
- var self = Container.call(this);
- var base = self.attachAsset('platform_base', {
+ rightPost.x = 75;
+ rightPost.y = 0;
+ var crossbar = self.attachAsset('goal_post', {
anchorX: 0.5,
anchorY: 0.5
});
- var top = self.attachAsset('platform_top', {
+ crossbar.x = 0;
+ crossbar.y = -200;
+ crossbar.rotation = Math.PI / 2;
+ var net = self.attachAsset('goal_net', {
anchorX: 0.5,
- anchorY: 0.5
+ anchorY: 1.0
});
- top.y = -15;
+ net.x = 0;
+ net.y = -10;
+ net.alpha = 0.3;
return self;
});
var Player = Container.expand(function () {
var self = Container.call(this);
@@ -203,34 +118,16 @@
var head = self.attachAsset('player_head', {
anchorX: 0.5,
anchorY: 0.5
});
- head.y = -60;
- var hat = self.attachAsset('player_hat', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- hat.y = -75;
- var leftEye = self.attachAsset('player_eyes', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- leftEye.x = -8;
- leftEye.y = -60;
- var rightEye = self.attachAsset('player_eyes', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- rightEye.x = 8;
- rightEye.y = -60;
+ head.y = -80;
self.velocityX = 0;
self.velocityY = 0;
self.onGround = false;
- self.speed = 8;
- self.jumpPower = 20;
+ self.speed = 10;
+ self.jumpPower = 18;
self.gravity = 0.8;
self.maxFallSpeed = 15;
- self.lives = 3;
self.update = function () {
// Apply gravity
if (!self.onGround) {
self.velocityY += self.gravity;
@@ -242,301 +139,138 @@
self.x += self.velocityX;
self.y += self.velocityY;
// Reset ground state
self.onGround = false;
- // Check platform collisions
- for (var i = 0; i < platforms.length; i++) {
- var platform = platforms[i];
- if (self.intersects(platform)) {
- if (self.velocityY > 0 && self.y - 40 < platform.y) {
- self.y = platform.y;
- if (self.velocityY > 5) {
- // Create dust particles when landing hard
- for (var j = 0; j < 4; j++) {
- var dust = new Particle();
- dust.x = self.x + (Math.random() - 0.5) * 40;
- dust.y = self.y;
- dust.velocityY = -Math.random() * 5;
- particles.push(dust);
- game.addChild(dust);
- }
- }
- self.velocityY = 0;
- self.onGround = true;
- }
- }
- }
// Check ground collision
- if (self.y >= groundLevel) {
- self.y = groundLevel;
- if (self.velocityY > 5) {
- // Create dust particles when landing hard
- for (var j = 0; j < 4; j++) {
- var dust = new Particle();
- dust.x = self.x + (Math.random() - 0.5) * 40;
- dust.y = self.y;
- dust.velocityY = -Math.random() * 5;
- particles.push(dust);
- game.addChild(dust);
- }
- }
+ if (self.y >= 2600) {
+ self.y = 2600;
self.velocityY = 0;
self.onGround = true;
}
- // Check if fell off screen
- if (self.y > 2732 + 100) {
- self.die();
- }
+ // Keep player on screen
+ if (self.x < 25) self.x = 25;
+ if (self.x > 2023) self.x = 2023;
// Apply friction
self.velocityX *= 0.85;
};
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.die = function () {
- self.lives--;
- if (self.lives <= 0) {
- LK.showGameOver();
- } else {
- self.respawn();
- }
- };
- self.respawn = function () {
- self.x = 200;
- self.y = groundLevel;
- self.velocityX = 0;
- self.velocityY = 0;
- LK.effects.flashObject(self, 0xffffff, 1000);
- };
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
- backgroundColor: 0x87CEEB
+ backgroundColor: 0x228b22
});
/****
* Game Code
****/
-// Visual effects
-// Enhanced ground and platforms
-// Enhanced flag
-// Enhanced enemy
-// Enhanced coin
-// Player parts
var groundLevel = 2600;
-var platforms = [];
-var coins = [];
-var enemies = [];
-var particles = [];
var player;
-var flag;
+var ball;
+var goal;
var scoreTxt;
-var livesTxt;
-var dragStartX = 0;
+var timeTxt;
var isDragging = false;
-var lastTouchX = 0;
-// Create ground
-for (var i = 0; i < 12; i++) {
- var groundBase = LK.getAsset('ground_base', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- groundBase.x = i * 200 + 100;
- groundBase.y = groundLevel + 30;
- game.addChild(groundBase);
- var groundTop = LK.getAsset('ground_top', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- groundTop.x = i * 200 + 100;
- groundTop.y = groundLevel + 7;
- game.addChild(groundTop);
- var groundDirt = LK.getAsset('ground_dirt', {
- anchorX: 0.5,
- anchorY: 0.5
- });
- groundDirt.x = i * 200 + 100;
- groundDirt.y = groundLevel + 40;
- game.addChild(groundDirt);
-}
-// Create platforms
-var platformPositions = [{
- x: 400,
- y: 2400
-}, {
- x: 700,
- y: 2200
-}, {
- x: 1100,
- y: 2000
-}, {
- x: 1500,
- y: 1800
-}, {
- x: 1800,
- y: 1600
-}];
-for (var i = 0; i < platformPositions.length; i++) {
- var platform = new Platform();
- platform.x = platformPositions[i].x;
- platform.y = platformPositions[i].y;
- platforms.push(platform);
- game.addChild(platform);
-}
-// Create coins
-var coinPositions = [{
- x: 300,
- y: 2500
-}, {
- x: 400,
- y: 2300
-}, {
- x: 700,
- y: 2100
-}, {
- x: 1100,
- y: 1900
-}, {
- x: 1500,
- y: 1700
-}, {
- x: 1800,
- y: 1500
-}];
-for (var i = 0; i < coinPositions.length; i++) {
- var coin = new Coin();
- coin.x = coinPositions[i].x;
- coin.y = coinPositions[i].y;
- coins.push(coin);
- game.addChild(coin);
-}
-// Create enemies
-var enemyPositions = [{
- x: 600,
- y: groundLevel
-}, {
- x: 1200,
- y: groundLevel
-}, {
- x: 1600,
- y: groundLevel
-}];
-for (var i = 0; i < enemyPositions.length; i++) {
- var enemy = new Enemy();
- enemy.x = enemyPositions[i].x;
- enemy.y = enemyPositions[i].y;
- enemies.push(enemy);
- game.addChild(enemy);
-}
+var dragStartX = 0;
+var gameTime = 60;
+var gameTimer;
+// Create soccer field
+var field = LK.getAsset('field_grass', {
+ anchorX: 0.5,
+ anchorY: 1.0
+});
+field.x = 1024;
+field.y = groundLevel;
+game.addChild(field);
+// Create center line
+var centerLine = LK.getAsset('field_line', {
+ anchorX: 0.5,
+ anchorY: 0.5
+});
+centerLine.x = 1024;
+centerLine.y = groundLevel - 25;
+game.addChild(centerLine);
+// Create goal
+goal = new Goal();
+goal.x = 1900;
+goal.y = groundLevel;
+game.addChild(goal);
// Create player
player = new Player();
-player.x = 200;
+player.x = 300;
player.y = groundLevel;
game.addChild(player);
-// Create flag
-flag = new Flag();
-flag.x = 1900;
-flag.y = groundLevel;
-game.addChild(flag);
+// Create ball
+ball = new Ball();
+ball.x = 1024;
+ball.y = 2400;
+game.addChild(ball);
// Create UI
-scoreTxt = new Text2('0', {
+scoreTxt = new Text2('Goals: 0', {
size: 60,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
-scoreTxt.setText(LK.getScore());
+scoreTxt.setText('Goals: ' + LK.getScore());
LK.gui.top.addChild(scoreTxt);
-livesTxt = new Text2('Lives: 3', {
+timeTxt = new Text2('Time: 60', {
size: 50,
fill: 0xFFFFFF
});
-livesTxt.anchor.set(0, 0);
-livesTxt.x = 120;
-livesTxt.y = 20;
-LK.gui.topLeft.addChild(livesTxt);
-// Camera follow player
-var camera = {
- x: 0,
- y: 0
-};
-function updateCamera() {
- camera.x = player.x - 1024;
- camera.y = player.y - 1800;
- // Clamp camera bounds
- if (camera.x < 0) camera.x = 0;
- if (camera.x > 400) camera.x = 400;
- if (camera.y > -500) camera.y = -500;
- if (camera.y < -1200) camera.y = -1200;
- game.x = -camera.x;
- game.y = -camera.y;
-}
+timeTxt.anchor.set(0, 0);
+timeTxt.x = 120;
+timeTxt.y = 20;
+LK.gui.topLeft.addChild(timeTxt);
+// Game timer
+gameTimer = LK.setInterval(function () {
+ gameTime--;
+ timeTxt.setText('Time: ' + gameTime);
+ if (gameTime <= 0) {
+ LK.clearInterval(gameTimer);
+ if (LK.getScore() >= 5) {
+ LK.showYouWin();
+ } else {
+ LK.showGameOver();
+ }
+ }
+}, 1000);
// Touch controls
game.down = function (x, y, obj) {
isDragging = true;
- dragStartX = x + camera.x;
- lastTouchX = x + camera.x;
- // Check if tap is for jumping
+ dragStartX = x;
+ // Jump on tap
if (y > 2000) {
player.jump();
}
};
game.move = function (x, y, obj) {
if (isDragging) {
- var currentX = x + camera.x;
- var deltaX = currentX - lastTouchX;
+ var deltaX = x - dragStartX;
if (deltaX > 5) {
player.moveRight();
} else if (deltaX < -5) {
player.moveLeft();
}
- lastTouchX = currentX;
+ dragStartX = x;
}
};
game.up = function (x, y, obj) {
isDragging = false;
};
game.update = function () {
- updateCamera();
- // Update lives display
- livesTxt.setText('Lives: ' + player.lives);
- // Remove destroyed coins
- for (var i = coins.length - 1; i >= 0; i--) {
- if (coins[i].collected) {
- coins.splice(i, 1);
- }
- }
- // Remove destroyed enemies
- for (var i = enemies.length - 1; i >= 0; i--) {
- if (enemies[i].defeated) {
- enemies.splice(i, 1);
- }
- }
- // Clean up destroyed particles
- for (var i = particles.length - 1; i >= 0; i--) {
- if (particles[i].life <= 0) {
- particles.splice(i, 1);
- }
- }
- // Dynamic background color based on player height
- var skyBlue = 0x87CEEB;
- var sunsetOrange = 0xFF8C69;
- var heightRatio = Math.max(0, Math.min(1, (2600 - player.y) / 1000));
- var r = Math.floor(135 + (255 - 135) * heightRatio);
- var g = Math.floor(206 + (140 - 206) * heightRatio);
- var b = Math.floor(235 + (105 - 235) * heightRatio);
- var dynamicColor = r << 16 | g << 8 | b;
- game.setBackgroundColor(dynamicColor);
+ // Update score display
+ scoreTxt.setText('Goals: ' + LK.getScore());
};
\ No newline at end of file
uzay gemisi. In-Game asset. 2d. High contrast. No shadows
beyaz renkli yıldız. In-Game asset. 2d. High contrast. No shadows
jüpiter. In-Game asset. 2d. High contrast. No shadows
satürn. In-Game asset. 2d. High contrast. No shadows
dünya. In-Game asset. 2d. High contrast. No shadows
asteroit. In-Game asset. 2d. High contrast. No shadows
bonus. In-Game asset. 2d. High contrast. No shadows
mermi. In-Game asset. 2d. High contrast. No shadows
patlama. In-Game asset. 2d. High contrast. No shadows