User prompt
Her 200 ponitten sonra boss gelsin onunda 10 canı olsun her hasar aldığında başka yere gitsin ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Triple shoot açıkken Arrow la biz bu yere atınca 3 tane atsın otomatik değil
User prompt
Eğer hack mod açıkken 200 puanı geçerse kırmıizı haziyla HACKER ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Eğer hack mod açıkken 100 puanı geçerse desin ama şöyle desin
User prompt
Eğer hack mode açıksa sen noob sun hack mode açmışsın dalge geçsin
User prompt
Auto battle yerine hack mode olsun
User prompt
Auto battle basınca enerji gitmesin bütün düşmanları vursun
User prompt
100 Arrow tuşunu sil onun yerine bir tus olsun ona basınca on bida basınca off on olunca 3 tane Arrow atalım
User prompt
Arrow ve enemyarrow duvara çarpınca oklar yok olsun
User prompt
Oklar duvara çarpınca yok olsun
User prompt
Bizim okumuz la düşmanın oku deyerse oklar birbirine çarpıp yok olsun
User prompt
O tuşa basıldığında enerji gitmesin
User prompt
Bir tuş olsun 100 ok atma ona basınca 100 ok atsın
User prompt
Arrow la enemyarrow un oku birbirine çarparsa yok olsun
User prompt
Enemy nereye ok atarsa oda oraya baksın
User prompt
Archer nereye ok atarsa oraya baksın
User prompt
Archer nereye ok atarsa oraya baksın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Ben karşıdaki adam bakiyo benim karakterim baksın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Nereye ateş edersek cöp adam oraya baksın ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
Adamlar gelmesin bı yerde rasgele doğsun ama ölünce başkası doğsun teker teker sonra hızlı canımız olsun 10 ok deyerse ölelim adamlarda bize ok atsın
User prompt
Please fix the bug: 'Uncaught TypeError: Cannot read properties of undefined (reading 'toGlobal')' in or related to this line: 'var gamePos = game.toLocal(obj.parent.toGlobal({' Line Number: 116
User prompt
Ekrana basıyorum ama ok gelmiyor
User prompt
Hata var
User prompt
Assagida tuş oosun ona basınca otomatik savaş olsun
User prompt
Otomatik savaş olsun
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Archer = Container.expand(function () { var self = Container.call(this); var archerGraphics = self.attachAsset('archer', { anchorX: 0.5, anchorY: 0.5 }); return self; }); var Arrow = Container.expand(function () { var self = Container.call(this); var arrowGraphics = self.attachAsset('arrow', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = 0; self.speedY = 0; self.update = function () { self.x += self.speedX; self.y += self.speedY; }; return self; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.attachAsset('enemy', { anchorX: 0.5, anchorY: 0.5 }); self.shootTimer = 0; self.shootRate = 120 + Math.random() * 60; // Random shooting interval self.update = function () { // Enemies don't move, they stay in place and shoot self.shootTimer++; if (self.shootTimer >= self.shootRate) { self.shootTimer = 0; // Shoot at player var dirX = archer.x - self.x; var dirY = archer.y - self.y; var distance = Math.sqrt(dirX * dirX + dirY * dirY); var normalX = dirX / distance; var normalY = dirY / distance; // Make enemy face the shooting direction self.rotation = Math.atan2(normalY, normalX); var enemyArrow = new EnemyArrow(); enemyArrow.x = self.x; enemyArrow.y = self.y; enemyArrow.speedX = normalX * 8; enemyArrow.speedY = normalY * 8; enemyArrow.rotation = Math.atan2(normalY, normalX); enemyArrows.push(enemyArrow); game.addChild(enemyArrow); } }; return self; }); var EnemyArrow = Container.expand(function () { var self = Container.call(this); var arrowGraphics = self.attachAsset('enemyArrow', { anchorX: 0.5, anchorY: 0.5 }); self.speedX = 0; self.speedY = 0; self.update = function () { self.x += self.speedX; self.y += self.speedY; }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x87CEEB }); /**** * Game Code ****/ var archer = game.addChild(new Archer()); archer.x = 150; archer.y = 2732 / 2; var arrows = []; var enemies = []; var enemyArrows = []; var enemySpawnTimer = 0; var enemySpawnRate = 120; // frames between spawns var playerHealth = 10; var maxEnemies = 1; // Start with 1 enemy, increase over time var energy = 100; var energyRegenTimer = 0; var isShooting = false; var shootingTimer = 0; var scoreTxt = new Text2('0', { size: 100, fill: 0xFFFFFF }); scoreTxt.anchor.set(0.5, 0); LK.gui.top.addChild(scoreTxt); scoreTxt.setText(LK.getScore()); var energyTxt = new Text2('Energy: 100', { size: 80, fill: 0x00ff00 }); energyTxt.anchor.set(1, 0); LK.gui.topRight.addChild(energyTxt); energyTxt.x = -20; energyTxt.y = 20; var healthTxt = new Text2('Health: 10', { size: 80, fill: 0xff0000 }); healthTxt.anchor.set(0, 0); LK.gui.topLeft.addChild(healthTxt); healthTxt.x = 120; // Avoid the platform menu icon healthTxt.y = 20; var autoShootTimer = 0; var autoBattleActive = false; // Create auto battle button var autoBattleButton = new Text2('AUTO BATTLE', { size: 80, fill: 0xff0000 }); autoBattleButton.anchor.set(0.5, 1); LK.gui.bottom.addChild(autoBattleButton); autoBattleButton.y = -50; // Create 100 arrow burst button var burstButton = new Text2('100 ARROWS', { size: 60, fill: 0x0066ff }); burstButton.anchor.set(0.5, 1); LK.gui.bottom.addChild(burstButton); burstButton.y = -150; // Button click handler autoBattleButton.down = function (x, y, obj) { autoBattleActive = !autoBattleActive; if (autoBattleActive) { autoBattleButton.setText('STOP AUTO'); autoBattleButton.tint = 0x00ff00; // Green when active } else { autoBattleButton.setText('AUTO BATTLE'); autoBattleButton.tint = 0xff0000; // Red when inactive } ; }; // Burst shooting variables var burstArrowCount = 0; var burstActive = false; // Burst button click handler burstButton.down = function (x, y, obj) { if (!burstActive) { burstActive = true; burstArrowCount = 100; burstButton.tint = 0x666666; // Gray when used } }; // Manual shooting - touch screen to shoot game.down = function (x, y, obj) { // Only allow manual shooting when auto battle is not active if (!autoBattleActive && energy > 0) { // Convert touch position to game coordinates // Check if obj and obj.parent exist before calling toGlobal if (obj && obj.parent && obj.parent.toGlobal) { var gamePos = game.toLocal(obj.parent.toGlobal({ x: x, y: y })); shootArrowAtTarget(gamePos.x, gamePos.y); } else { // Fallback: use x, y directly as they should already be in the correct coordinate system shootArrowAtTarget(x, y); } } }; function shootArrowAtTarget(targetX, targetY) { // Check if player has enough energy if (energy <= 0) { return; } // Calculate direction from archer to target point var dirX = targetX - archer.x; var dirY = targetY - archer.y; var distance = Math.sqrt(dirX * dirX + dirY * dirY); // Normalize direction var normalX = dirX / distance; var normalY = dirY / distance; // Make archer face the shooting direction archer.rotation = Math.atan2(normalY, normalX); // Create arrow var newArrow = new Arrow(); newArrow.x = archer.x; newArrow.y = archer.y; newArrow.speedX = normalX * 15; newArrow.speedY = normalY * 15; // Rotate arrow to face direction newArrow.rotation = Math.atan2(normalY, normalX); arrows.push(newArrow); game.addChild(newArrow); LK.getSound('shoot').play(); // Decrease energy energy -= 2; // Set shooting state isShooting = true; shootingTimer = 0; // Update energy display energyTxt.setText('Energy: ' + energy); // Change color based on energy level if (energy <= 20) { energyTxt.tint = 0xff0000; // Red when low } else if (energy <= 50) { energyTxt.tint = 0xffff00; // Yellow when medium } else { energyTxt.tint = 0x00ff00; // Green when high } } game.update = function () { // Burst arrow firing logic if (burstActive && burstArrowCount > 0) { // Fire 3 arrows per frame to make it fast but visible for (var burst = 0; burst < 3 && burstArrowCount > 0; burst++) { // Find nearest enemy for targeting var nearestEnemy = null; var nearestDistance = Infinity; for (var e = 0; e < enemies.length; e++) { var enemy = enemies[e]; var distanceToEnemy = Math.sqrt(Math.pow(enemy.x - archer.x, 2) + Math.pow(enemy.y - archer.y, 2)); if (distanceToEnemy < nearestDistance) { nearestDistance = distanceToEnemy; nearestEnemy = enemy; } } // If enemy exists, shoot at it, otherwise shoot straight right var targetX = nearestEnemy ? nearestEnemy.x : archer.x + 500; var targetY = nearestEnemy ? nearestEnemy.y : archer.y; // Add some spread to make it look more natural var spreadX = (Math.random() - 0.5) * 100; var spreadY = (Math.random() - 0.5) * 100; targetX += spreadX; targetY += spreadY; // Calculate direction var dirX = targetX - archer.x; var dirY = targetY - archer.y; var distance = Math.sqrt(dirX * dirX + dirY * dirY); var normalX = dirX / distance; var normalY = dirY / distance; // Make archer face the shooting direction archer.rotation = Math.atan2(normalY, normalX); // Create arrow var newArrow = new Arrow(); newArrow.x = archer.x; newArrow.y = archer.y; newArrow.speedX = normalX * 15; newArrow.speedY = normalY * 15; newArrow.rotation = Math.atan2(normalY, normalX); arrows.push(newArrow); game.addChild(newArrow); burstArrowCount--; } // Play shoot sound occasionally during burst if (burstArrowCount % 10 === 0) { LK.getSound('shoot').play(); } // End burst when all arrows fired if (burstArrowCount <= 0) { burstActive = false; burstButton.tint = 0x0066ff; // Reset button color } } // Automatic shooting logic - only when auto battle is active if (autoBattleActive) { autoShootTimer++; if (autoShootTimer >= 45 && energy > 0) { // Shoot every 0.75 seconds if energy available autoShootTimer = 0; // Find nearest enemy var nearestEnemy = null; var nearestDistance = Infinity; for (var e = 0; e < enemies.length; e++) { var enemy = enemies[e]; var distanceToEnemy = Math.sqrt(Math.pow(enemy.x - archer.x, 2) + Math.pow(enemy.y - archer.y, 2)); if (distanceToEnemy < nearestDistance) { nearestDistance = distanceToEnemy; nearestEnemy = enemy; } } // Shoot at nearest enemy if found (check if enemy still exists) if (nearestEnemy && enemies.indexOf(nearestEnemy) !== -1) { shootArrowAtTarget(nearestEnemy.x, nearestEnemy.y); } } } // Update shooting timer if (isShooting) { shootingTimer++; if (shootingTimer >= 30) { // Stop shooting state after 0.5 seconds isShooting = false; } } // Update energy regeneration only when not shooting (every 60 frames = 1 second at 60 FPS) if (!isShooting) { energyRegenTimer++; if (energyRegenTimer >= 60) { energyRegenTimer = 0; if (energy < 100) { energy += 1; // Update energy display energyTxt.setText('Energy: ' + energy); // Change color based on energy level if (energy <= 20) { energyTxt.tint = 0xff0000; // Red when low } else if (energy <= 50) { energyTxt.tint = 0xffff00; // Yellow when medium } else { energyTxt.tint = 0x00ff00; // Green when high } } } } else { energyRegenTimer = 0; // Reset regen timer when shooting } // Spawn enemies randomly on screen when needed if (enemies.length < maxEnemies) { enemySpawnTimer++; if (enemySpawnTimer >= enemySpawnRate) { enemySpawnTimer = 0; // Spawn new enemy at random position var newEnemy = new Enemy(); newEnemy.x = Math.random() * (2048 - 200) + 100; newEnemy.y = Math.random() * (2732 - 200) + 100; // Make sure enemy doesn't spawn too close to archer var distToArcher = Math.sqrt(Math.pow(newEnemy.x - archer.x, 2) + Math.pow(newEnemy.y - archer.y, 2)); if (distToArcher < 200) { // Respawn farther away newEnemy.x = Math.random() * (2048 - 400) + 200; if (newEnemy.x > archer.x - 200 && newEnemy.x < archer.x + 200) { newEnemy.x += 300; } } enemies.push(newEnemy); game.addChild(newEnemy); } } // Update arrows for (var i = arrows.length - 1; i >= 0; i--) { var arrow = arrows[i]; // Remove arrows that hit walls or go off screen if (arrow.x > 2048 || arrow.x < 0 || arrow.y > 2732 || arrow.y < 0) { arrow.destroy(); arrows.splice(i, 1); continue; } // Check arrow-enemy arrow collisions var arrowDestroyed = false; for (var k = enemyArrows.length - 1; k >= 0; k--) { var enemyArrow = enemyArrows[k]; if (arrow && enemyArrow && arrow.intersects(enemyArrow)) { // Both arrows destroy each other arrow.destroy(); arrows.splice(i, 1); enemyArrow.destroy(); enemyArrows.splice(k, 1); arrowDestroyed = true; break; } } // Skip enemy collision check if arrow was destroyed by enemy arrow if (arrowDestroyed) { continue; } // Check arrow-enemy collisions for (var j = enemies.length - 1; j >= 0; j--) { var enemy = enemies[j]; if (enemy && arrow && arrow.intersects(enemy)) { // Hit enemy LK.setScore(LK.getScore() + 10); scoreTxt.setText(LK.getScore()); LK.getSound('hit').play(); LK.effects.flashObject(enemy, 0xff0000, 200); // Remove arrow and enemy arrow.destroy(); arrows.splice(i, 1); enemy.destroy(); enemies.splice(j, 1); break; } } } // Update enemy arrows for (var m = enemyArrows.length - 1; m >= 0; m--) { var enemyArrow = enemyArrows[m]; // Remove arrows that hit walls or go off screen if (enemyArrow.x > 2048 || enemyArrow.x < 0 || enemyArrow.y > 2732 || enemyArrow.y < 0) { enemyArrow.destroy(); enemyArrows.splice(m, 1); continue; } // Check if enemy arrow hits player if (enemyArrow.intersects(archer)) { playerHealth--; healthTxt.setText('Health: ' + playerHealth); LK.getSound('playerHit').play(); LK.effects.flashObject(archer, 0xff0000, 300); enemyArrow.destroy(); enemyArrows.splice(m, 1); // Check if player is dead if (playerHealth <= 0) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); return; } continue; } } // When enemy dies, increase max enemies and spawn rate for difficulty if (LK.getScore() > 0 && LK.getScore() % 50 === 0) { if (maxEnemies < 5) { maxEnemies++; } if (enemySpawnRate > 30) { enemySpawnRate -= 5; } } };
===================================================================
--- original.js
+++ change.js
@@ -132,8 +132,16 @@
});
autoBattleButton.anchor.set(0.5, 1);
LK.gui.bottom.addChild(autoBattleButton);
autoBattleButton.y = -50;
+// Create 100 arrow burst button
+var burstButton = new Text2('100 ARROWS', {
+ size: 60,
+ fill: 0x0066ff
+});
+burstButton.anchor.set(0.5, 1);
+LK.gui.bottom.addChild(burstButton);
+burstButton.y = -150;
// Button click handler
autoBattleButton.down = function (x, y, obj) {
autoBattleActive = !autoBattleActive;
if (autoBattleActive) {
@@ -144,8 +152,19 @@
autoBattleButton.tint = 0xff0000; // Red when inactive
}
;
};
+// Burst shooting variables
+var burstArrowCount = 0;
+var burstActive = false;
+// Burst button click handler
+burstButton.down = function (x, y, obj) {
+ if (!burstActive) {
+ burstActive = true;
+ burstArrowCount = 100;
+ burstButton.tint = 0x666666; // Gray when used
+ }
+};
// Manual shooting - touch screen to shoot
game.down = function (x, y, obj) {
// Only allow manual shooting when auto battle is not active
if (!autoBattleActive && energy > 0) {
@@ -204,8 +223,60 @@
energyTxt.tint = 0x00ff00; // Green when high
}
}
game.update = function () {
+ // Burst arrow firing logic
+ if (burstActive && burstArrowCount > 0) {
+ // Fire 3 arrows per frame to make it fast but visible
+ for (var burst = 0; burst < 3 && burstArrowCount > 0; burst++) {
+ // Find nearest enemy for targeting
+ var nearestEnemy = null;
+ var nearestDistance = Infinity;
+ for (var e = 0; e < enemies.length; e++) {
+ var enemy = enemies[e];
+ var distanceToEnemy = Math.sqrt(Math.pow(enemy.x - archer.x, 2) + Math.pow(enemy.y - archer.y, 2));
+ if (distanceToEnemy < nearestDistance) {
+ nearestDistance = distanceToEnemy;
+ nearestEnemy = enemy;
+ }
+ }
+ // If enemy exists, shoot at it, otherwise shoot straight right
+ var targetX = nearestEnemy ? nearestEnemy.x : archer.x + 500;
+ var targetY = nearestEnemy ? nearestEnemy.y : archer.y;
+ // Add some spread to make it look more natural
+ var spreadX = (Math.random() - 0.5) * 100;
+ var spreadY = (Math.random() - 0.5) * 100;
+ targetX += spreadX;
+ targetY += spreadY;
+ // Calculate direction
+ var dirX = targetX - archer.x;
+ var dirY = targetY - archer.y;
+ var distance = Math.sqrt(dirX * dirX + dirY * dirY);
+ var normalX = dirX / distance;
+ var normalY = dirY / distance;
+ // Make archer face the shooting direction
+ archer.rotation = Math.atan2(normalY, normalX);
+ // Create arrow
+ var newArrow = new Arrow();
+ newArrow.x = archer.x;
+ newArrow.y = archer.y;
+ newArrow.speedX = normalX * 15;
+ newArrow.speedY = normalY * 15;
+ newArrow.rotation = Math.atan2(normalY, normalX);
+ arrows.push(newArrow);
+ game.addChild(newArrow);
+ burstArrowCount--;
+ }
+ // Play shoot sound occasionally during burst
+ if (burstArrowCount % 10 === 0) {
+ LK.getSound('shoot').play();
+ }
+ // End burst when all arrows fired
+ if (burstArrowCount <= 0) {
+ burstActive = false;
+ burstButton.tint = 0x0066ff; // Reset button color
+ }
+ }
// Automatic shooting logic - only when auto battle is active
if (autoBattleActive) {
autoShootTimer++;
if (autoShootTimer >= 45 && energy > 0) {
@@ -282,29 +353,29 @@
}
// Update arrows
for (var i = arrows.length - 1; i >= 0; i--) {
var arrow = arrows[i];
- // Remove arrows that go off screen
- if (arrow.x > 2100 || arrow.x < -50 || arrow.y > 2800 || arrow.y < -50) {
+ // Remove arrows that hit walls or go off screen
+ if (arrow.x > 2048 || arrow.x < 0 || arrow.y > 2732 || arrow.y < 0) {
arrow.destroy();
arrows.splice(i, 1);
continue;
}
- // Check collision with enemy arrows
+ // Check arrow-enemy arrow collisions
var arrowDestroyed = false;
for (var k = enemyArrows.length - 1; k >= 0; k--) {
var enemyArrow = enemyArrows[k];
- if (enemyArrow && arrow && arrow.intersects(enemyArrow)) {
- // Arrows collide and destroy each other
+ if (arrow && enemyArrow && arrow.intersects(enemyArrow)) {
+ // Both arrows destroy each other
arrow.destroy();
arrows.splice(i, 1);
enemyArrow.destroy();
enemyArrows.splice(k, 1);
arrowDestroyed = true;
break;
}
}
- // Skip enemy collision check if arrow was destroyed by arrow collision
+ // Skip enemy collision check if arrow was destroyed by enemy arrow
if (arrowDestroyed) {
continue;
}
// Check arrow-enemy collisions
@@ -327,10 +398,10 @@
}
// Update enemy arrows
for (var m = enemyArrows.length - 1; m >= 0; m--) {
var enemyArrow = enemyArrows[m];
- // Remove arrows that go off screen
- if (enemyArrow.x > 2100 || enemyArrow.x < -50 || enemyArrow.y > 2800 || enemyArrow.y < -50) {
+ // Remove arrows that hit walls or go off screen
+ if (enemyArrow.x > 2048 || enemyArrow.x < 0 || enemyArrow.y > 2732 || enemyArrow.y < 0) {
enemyArrow.destroy();
enemyArrows.splice(m, 1);
continue;
}