User prompt
elimizde silah olsun ve mermisi düzgün gitsin ve claim zoneleri 2 kere sıkınca bizim olabilsin uzaktan sıkabilelim mermi sonsuza kadar gitsin sağ altta mermisi yazsın 7 şarjörü olsun köpek öldürünce 2 şarjör çıksın
User prompt
köpek bizi takip etmiyor düz gidip duruyor bizi full takip etsin kovalasın ve bizi yakalayınca 3 saniye gerisayım başlasın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
köpekte her 10 saniyede bir gelsin ve bizden hızlı gitsin
User prompt
0.5 saniyede bir sarı şeyden çıksın o power up 10 saniyede bir çıksın ve hızlandırması 5 saniye sürsün veuzaktan karakterimizin uzağında doğan köpek çıksın 1 tane her 35 saniyede o köpek karakterimize saldırsın ve saldırınca karakterimiz hemewn ölmesin bir sahne çıksın ekrana hızlıca dokun desin dokununca bizi bıraksın sanki kolumuzdan tutmuşta elimizi sallıyormusuz gibi ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
you win final score değilde record = saniyesi yazsın yukarıda territory : yazan yerde territory = 15 WİN yazsın ve herşeyin hitboxu büyüsün
User prompt
o sarı şeyden claim yazan şeyden her 3 saniyede bir çıksın
User prompt
power uplar en fazla 2 tane çıksın ve claim yazan sarı daireler alınca gitsin o seffaklık kalmasın ve ondan en fazla 5 tane çıksın ve oyunda süre olsun kronometre yukarda olsun ve oyun bitince rekorunun süresi yazsın ve o sarı şeyden 15 tane alınca bitsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1, @upit/storage.v1
User prompt
o power up tan yavaş yavaş her 5 saniyede 1 tane çıksın
User prompt
fikrimi değiştirdim o araba değil power up olsun hız versin deyince ve alınca gitsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
1 tane araba doğsun rastgele bir yerde o arabaya binince hızımız artsın
User prompt
claim olan yuvarlaklar az sayıda oluşsun
Code edit (1 edits merged)
Please save this source code
User prompt
biraz daha büyüsün ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
claim yazıları okunacak gibi olsun büyüsün ↪💡 Consider importing and using the following plugins: @upit/tween.v1
Initial prompt
Please save this source code
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); var storage = LK.import("@upit/storage.v1"); /**** * Classes ****/ var Character = Container.expand(function () { var self = Container.call(this); var characterGraphics = self.attachAsset('character', { anchorX: 0.5, anchorY: 0.5 }); self.targetX = 0; self.targetY = 0; self.moveSpeed = 8; self.baseSpeed = 8; self.carSpeed = 16; self.inCar = false; self.update = function () { var dx = self.targetX - self.x; var dy = self.targetY - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 5) { var moveX = dx / distance * self.moveSpeed; var moveY = dy / distance * self.moveSpeed; var newX = self.x + moveX; var newY = self.y + moveY; // Keep character within bounds (accounting for character size) if (newX >= 90 && newX <= 1958 && newY >= 90 && newY <= 2642) { self.x = newX; self.y = newY; } } }; self.setTarget = function (x, y) { self.targetX = x; self.targetY = y; }; self.applySpeedBoost = function () { self.moveSpeed = self.carSpeed; LK.setTimeout(function () { self.moveSpeed = self.baseSpeed; }, 5000); // Speed boost lasts 5 seconds }; return self; }); var ClaimZone = Container.expand(function () { var self = Container.call(this); var zoneGraphics = self.attachAsset('claimZone', { anchorX: 0.5, anchorY: 0.5 }); var claimText = new Text2('CLAIM', { size: 32, fill: '#FFFFFF' }); claimText.anchor.set(0.5, 1); claimText.y = -45; self.addChild(claimText); // Add pulsing animation to make text more readable function startClaimTextAnimation() { tween(claimText, { scaleX: 1.5, scaleY: 1.5 }, { duration: 800, easing: tween.easeInOut, onFinish: function onFinish() { tween(claimText, { scaleX: 1.0, scaleY: 1.0 }, { duration: 800, easing: tween.easeInOut, onFinish: startClaimTextAnimation }); } }); } startClaimTextAnimation(); self.isClaimed = false; self.claim = function () { if (!self.isClaimed) { self.isClaimed = true; self.removeChild(zoneGraphics); self.removeChild(claimText); var claimedGraphics = self.attachAsset('claimedZone', { anchorX: 0.5, anchorY: 0.5, alpha: 1.0 }); var claimedText = new Text2('CLAIMED', { size: 20, fill: '#FFFFFF' }); claimedText.anchor.set(0.5, 1); claimedText.y = -40; self.addChild(claimedText); return true; } return false; }; return self; }); var PowerUp = Container.expand(function () { var self = Container.call(this); var powerUpGraphics = self.attachAsset('powerUp', { anchorX: 0.5, anchorY: 0.5 }); var powerUpText = new Text2('SPEED', { size: 24, fill: '#FFFFFF' }); powerUpText.anchor.set(0.5, 0.5); self.addChild(powerUpText); // Add pulsing animation to power up function startPowerUpAnimation() { tween(self, { scaleX: 1.3, scaleY: 1.3 }, { duration: 600, easing: tween.easeInOut, onFinish: function onFinish() { tween(self, { scaleX: 1.0, scaleY: 1.0 }, { duration: 600, easing: tween.easeInOut, onFinish: startPowerUpAnimation }); } }); } startPowerUpAnimation(); return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x2E8B57 }); /**** * Game Code ****/ var character = new Character(); character.x = 1024; character.y = 1366; game.addChild(character); var claimZones = []; var totalZones = 5; // Power up management var powerUps = []; // Game timer var gameStartTime = Date.now(); var gameTimer = 0; // Function to create power up at random location function createPowerUp() { var powerUp = new PowerUp(); var powerUpValidPosition = false; var powerUpAttempts = 0; while (!powerUpValidPosition && powerUpAttempts < 50) { powerUp.x = 150 + Math.random() * 1748; powerUp.y = 150 + Math.random() * 2432; // Check distance from character var powerUpDx = powerUp.x - character.x; var powerUpDy = powerUp.y - character.y; var distanceFromCharacter = Math.sqrt(powerUpDx * powerUpDx + powerUpDy * powerUpDy); if (distanceFromCharacter > 200) { powerUpValidPosition = true; } powerUpAttempts++; } powerUps.push(powerUp); game.addChild(powerUp); } // Spawn first power up immediately createPowerUp(); // Set timer to spawn power ups every 5 seconds LK.setInterval(function () { if (powerUps.length < 2) { createPowerUp(); } }, 5000); // Create walls around the perimeter var walls = []; // Top wall for (var i = 0; i < 42; i++) { var topWall = LK.getAsset('wall', { anchorX: 0.5, anchorY: 0.5, x: i * 50 + 25, y: 25 }); game.addChild(topWall); walls.push(topWall); } // Bottom wall for (var i = 0; i < 42; i++) { var bottomWall = LK.getAsset('wall', { anchorX: 0.5, anchorY: 0.5, x: i * 50 + 25, y: 2707 }); game.addChild(bottomWall); walls.push(bottomWall); } // Left wall for (var i = 1; i < 54; i++) { var leftWall = LK.getAsset('wall', { anchorX: 0.5, anchorY: 0.5, x: 25, y: i * 50 + 25 }); game.addChild(leftWall); walls.push(leftWall); } // Right wall for (var i = 1; i < 54; i++) { var rightWall = LK.getAsset('wall', { anchorX: 0.5, anchorY: 0.5, x: 2023, y: i * 50 + 25 }); game.addChild(rightWall); walls.push(rightWall); } // Create initial claim zones function createClaimZone() { var zone = new ClaimZone(); var validPosition = false; var attempts = 0; while (!validPosition && attempts < 50) { zone.x = 150 + Math.random() * 1748; zone.y = 150 + Math.random() * 2432; // Check distance from character var dx = zone.x - character.x; var dy = zone.y - character.y; var distanceFromCharacter = Math.sqrt(dx * dx + dy * dy); // Check distance from other zones var tooClose = false; for (var i = 0; i < claimZones.length; i++) { var otherZone = claimZones[i]; var zdx = zone.x - otherZone.x; var zdy = zone.y - otherZone.y; var distanceFromZone = Math.sqrt(zdx * zdx + zdy * zdy); if (distanceFromZone < 200) { tooClose = true; break; } } if (distanceFromCharacter > 150 && !tooClose) { validPosition = true; } attempts++; } return zone; } // Generate initial claim zones for (var i = 0; i < totalZones; i++) { var zone = createClaimZone(); claimZones.push(zone); game.addChild(zone); } // Score display var scoreTxt = new Text2('Territory: 0', { size: 60, fill: '#FFFFFF' }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); // Timer display var timerTxt = new Text2('Time: 00:00', { size: 50, fill: '#FFFFFF' }); timerTxt.anchor.set(0.5, 0); timerTxt.y = 80; LK.gui.top.addChild(timerTxt); // Mouse/touch controls game.move = function (x, y, obj) { character.setTarget(x, y); }; game.down = function (x, y, obj) { character.setTarget(x, y); }; // Main game loop game.update = function () { // Update timer gameTimer = Math.floor((Date.now() - gameStartTime) / 1000); var minutes = Math.floor(gameTimer / 60); var seconds = gameTimer % 60; var timeString = (minutes < 10 ? '0' : '') + minutes + ':' + (seconds < 10 ? '0' : '') + seconds; timerTxt.setText('Time: ' + timeString); // Check for power up collection for (var p = powerUps.length - 1; p >= 0; p--) { var powerUp = powerUps[p]; var powerUpDx = character.x - powerUp.x; var powerUpDy = character.y - powerUp.y; var powerUpDistance = Math.sqrt(powerUpDx * powerUpDx + powerUpDy * powerUpDy); if (powerUpDistance < 50) { character.applySpeedBoost(); powerUp.destroy(); powerUps.splice(p, 1); } } // Check for zone claims for (var i = claimZones.length - 1; i >= 0; i--) { var zone = claimZones[i]; if (!zone.isClaimed) { var dx = character.x - zone.x; var dy = character.y - zone.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 50) { if (zone.claim()) { LK.setScore(LK.getScore() + 1); scoreTxt.setText('Territory: ' + LK.getScore()); LK.getSound('claim').play(); // Remove claimed zone instead of creating new one claimZones.splice(i, 1); zone.destroy(); // Check win condition - game ends at 15 claims if (LK.getScore() >= 15) { // Store the record time var currentTime = storage.bestTime || 999999; if (gameTimer < currentTime) { storage.bestTime = gameTimer; } LK.showYouWin(); } } } } } };
===================================================================
--- original.js
+++ change.js
@@ -1,8 +1,9 @@
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
+var storage = LK.import("@upit/storage.v1");
/****
* Classes
****/
@@ -87,9 +88,10 @@
self.removeChild(zoneGraphics);
self.removeChild(claimText);
var claimedGraphics = self.attachAsset('claimedZone', {
anchorX: 0.5,
- anchorY: 0.5
+ anchorY: 0.5,
+ alpha: 1.0
});
var claimedText = new Text2('CLAIMED', {
size: 20,
fill: '#FFFFFF'
@@ -153,11 +155,14 @@
character.x = 1024;
character.y = 1366;
game.addChild(character);
var claimZones = [];
-var totalZones = 8;
+var totalZones = 5;
// Power up management
var powerUps = [];
+// Game timer
+var gameStartTime = Date.now();
+var gameTimer = 0;
// Function to create power up at random location
function createPowerUp() {
var powerUp = new PowerUp();
var powerUpValidPosition = false;
@@ -180,9 +185,11 @@
// Spawn first power up immediately
createPowerUp();
// Set timer to spawn power ups every 5 seconds
LK.setInterval(function () {
- createPowerUp();
+ if (powerUps.length < 2) {
+ createPowerUp();
+ }
}, 5000);
// Create walls around the perimeter
var walls = [];
// Top wall
@@ -272,8 +279,16 @@
fill: '#FFFFFF'
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
+// Timer display
+var timerTxt = new Text2('Time: 00:00', {
+ size: 50,
+ fill: '#FFFFFF'
+});
+timerTxt.anchor.set(0.5, 0);
+timerTxt.y = 80;
+LK.gui.top.addChild(timerTxt);
// Mouse/touch controls
game.move = function (x, y, obj) {
character.setTarget(x, y);
};
@@ -281,8 +296,14 @@
character.setTarget(x, y);
};
// Main game loop
game.update = function () {
+ // Update timer
+ gameTimer = Math.floor((Date.now() - gameStartTime) / 1000);
+ var minutes = Math.floor(gameTimer / 60);
+ var seconds = gameTimer % 60;
+ var timeString = (minutes < 10 ? '0' : '') + minutes + ':' + (seconds < 10 ? '0' : '') + seconds;
+ timerTxt.setText('Time: ' + timeString);
// Check for power up collection
for (var p = powerUps.length - 1; p >= 0; p--) {
var powerUp = powerUps[p];
var powerUpDx = character.x - powerUp.x;
@@ -305,14 +326,18 @@
if (zone.claim()) {
LK.setScore(LK.getScore() + 1);
scoreTxt.setText('Territory: ' + LK.getScore());
LK.getSound('claim').play();
- // Create new zone to replace claimed one
- var newZone = createClaimZone();
- claimZones.push(newZone);
- game.addChild(newZone);
- // Check win condition
- if (LK.getScore() >= 25) {
+ // Remove claimed zone instead of creating new one
+ claimZones.splice(i, 1);
+ zone.destroy();
+ // Check win condition - game ends at 15 claims
+ if (LK.getScore() >= 15) {
+ // Store the record time
+ var currentTime = storage.bestTime || 999999;
+ if (gameTimer < currentTime) {
+ storage.bestTime = gameTimer;
+ }
LK.showYouWin();
}
}
}