User prompt
Please fix the bug: 'Uncaught TypeError: Cannot set properties of undefined (setting 'x')' in or related to this line: 'fighterJet.x = x;' Line Number: 863
User prompt
תוסיף מסך לפני שהמשחק נטען, שבו המשתמש יכול להכניס את השם שלו. יש טבלה עם תוצאות של כולם, ואפשר להתברג בטבלה. במסך הפתיחה יש התחל משחק, ויש טבלת התוצאות עם התוצאה הטובה ביותר של כל טייס ↪💡 Consider importing and using the following plugins: @upit/storage.v1
User prompt
קצב טעינת הנורים תעלה ל2.5 שניות תגדיל ב3% את הייצור של S-300
User prompt
תגביר את קצב הטעינה של הנורים, תוריד לשנייה אחת את הזמן המתנה אחרי הפגיעה של טעינת הפצצה
User prompt
תעלה את התוחלת ל5.5 שניות, ואת השונות ל1.5 שניות תפחית במעט את היווצרות הסוללות S-300 תנמיך ב 5 פיקסלים את איפה שנוצר הבניין הצבאי ליד הכביש הניקוד עובד ככה: הריסה של משאית צבאית 5 נקודות הריסה של משאית רגילה מפחית 5 נקודות הריסה של בניין צבאי 10 נקודות של בניין אזרחי מפחית 10 נקודות השמדה של סוללת S-300 15 נקודות השמדה של טיל באמצעות נור נקודה אחת
User prompt
תוריד את התוחלת ל-5 שניות ואת השונות לשנייה אחת תגביה בעוד 20 פיקסלים את איפה שמיוצר הבניין הרגיל ליד הכביש
User prompt
תוריד את התוחלת ל-6 שניות של יצירת הכבישים תגביה ב-5 פיקסלים את המיקום של הבניין הרגיל כשהוא נוצר ליד הכביש
User prompt
תשנה את הקריטריונים ליצירת כביש: זמן שמוגרל ככה, כל תוחלת של 9 שניות עם שונות 2 שניות, וככה אחרי כמות כזאת של זמן ייוצר כביש
User prompt
תשנה את הקריטריונים ליצירת כביש: זמן שמוגרל ככה, כל תוחלת של 9 שניות עם שונות 2 שניות, וככה אחרי כמות כזאת של זמן ייוצר כביש
User prompt
תוריד את כמות הS-300 שקיימים בקצת תעשה שזה לא יחכה שהכביש הנוכחי יעלם, והוא כבר יצור כביש חדש
User prompt
תפחית את התנאים ליצירת כביש. שייצור כביש אחרי פחות זמן ומרחק בהרבה
User prompt
מעולה עכשיו, תאפשר יצירת כביש כשעדיין יש כבר כביש אחד במסך, כל עוד המרחק ביניהם מאפשר
User prompt
תעשה שכבישים נוצרים רק מראש העמוד, כאשר מגיע הזמן לפי המרחק שהוגרל
User prompt
כשמתחיל המשחק, ראש העמוד זה הכביש הראשון. הוא יורד ביחד עם התקדמות המשחק. המשחק מגריל רווח לכביש הבא, וכשמגיע הרגע יוצר אותו עם המבנים והרכבים שלו
User prompt
עכשיו אין כבישים בכלל, רק סוללות S-300, וגלל שאין כבישים אין גם בתים או רכבים
User prompt
הכביש צריך להיות סטטי. הוא נוצר ויורד עם התקדמות המשחק. יש כמה כבישים כמובן. כמו הבניין, נשאר קבוע במקום שלו
User prompt
תגדיל את המרחק המינימלי בין כל 2 כבישים בפי 2 הכביש לא זז. הוא מצויר במקום מסוים, ושם הוא נשאר. סביר לראות כמה כבישים במקביל תוך כדי טיסה. כרגע הכביש כאילו השורה הראשונה במסך ותקוע שם
User prompt
לפחות בניין אחד ליד כל כביש לפחות רכב אחד בכל כביש תצייר גם את הכבישים, שיראו אותם
User prompt
חייב להיות מרחק מסוים בין 2 בניינים, רגילים או צבאיים עוד טיפה מרחק לאיפה שנוסעים הרכבים בין 2 סשנים של כבישים, מרחק של לפחות גודל של 2 בניינים
User prompt
המבנים והרכבים לא נבנים סתם ככה במיקום רנדומליים, אלא בצורה רנדומלית, כל מרחק רנדמולי יש כביש לרוחב המסך. על הכביש יכולים לנסוע כמות רנדומלית של משאיות ושל רכבים רגילים. בצמוד לכביש מלמעלה, לאורך הכביש, יכולים להיות ממקומים מבנים צבאיים או רגילים סוללות נגד אוויר, נמצאות בטווחים שבין הביינים לכבישים, בשטחים המתים
User prompt
במקום לסובב את התמונה, תעשה לה מראה כשמשתנה הכיוון
User prompt
בניין רגיל גם יכול לההירס רק על ידי פצצה שמוטלת ולא על ידי התותח הרכבים באיך שהם מוגדים כולם לכיוון שמאל אם הם נעים לכיוון מסוים, תסובב את הרכב ככה שהוא יפנה לאותו כיוון ↪💡 Consider importing and using the following plugins: @upit/tween.v1
User prompt
רק פצצה יכולה להמשיד משגרי S-300 ובניינים טיל רגיל מהתותח לא
User prompt
תנועה לרכבים רק בכיוון אחד שנבחר רנדומלי ביצירת הרכב רק פצצה יכולה להמשיד משגרי S-300 ובניינים טיל רגיל מהתותח לא
User prompt
הרבה יותר תנועה לרכבים. הפחתת נקודות לפגיעה בנניין רגיל ↪💡 Consider importing and using the following plugins: @upit/tween.v1
/**** * Plugins ****/ var tween = LK.import("@upit/tween.v1"); /**** * Classes ****/ var Bomb = Container.expand(function () { var self = Container.call(this); var bombGraphics = self.attachAsset('bomb', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 8; self.targetX = 0; self.targetY = 0; self.update = function () { // Basic fallback movement if no tween is active if (!self.targetX && !self.targetY) { self.y += self.speed; } }; return self; }); var Bullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = -12; self.lastX = 0; self.lastY = 0; self.stuckTimer = 0; self.update = function () { self.y += self.speed; // Track last position to detect if bullet is stuck var moveThreshold = 2; // Minimum movement required var dx = Math.abs(self.x - self.lastX); var dy = Math.abs(self.y - self.lastY); var totalMovement = dx + dy; // If bullet hasn't moved enough, increment stuck timer if (totalMovement < moveThreshold) { self.stuckTimer++; } else { self.stuckTimer = 0; // Reset timer if bullet is moving } // If stuck for more than 3 seconds (180 frames at 60fps), mark for destruction if (self.stuckTimer >= 180) { self.destroy(); return; } // Store current position for next frame comparison self.lastX = self.x; self.lastY = self.y; }; return self; }); var DestructionMark = Container.expand(function () { var self = Container.call(this); var markGraphics = self.attachAsset('explosion', { anchorX: 0.5, anchorY: 0.5 }); markGraphics.tint = 0x000000; // Black color markGraphics.alpha = 0.8; self.update = function () { self.y += scrollSpeed; // Move with ground scroll }; return self; }); var Explosion = Container.expand(function () { var self = Container.call(this); var explosionGraphics = self.attachAsset('explosion', { anchorX: 0.5, anchorY: 0.5 }); self.lifespan = 30; self.update = function () { self.lifespan--; self.alpha = self.lifespan / 30; if (self.lifespan <= 0) { self.destroy(); } }; return self; }); var FighterJet = Container.expand(function () { var self = Container.call(this); var jetGraphics = self.attachAsset('fighterJet', { anchorX: 0.5, anchorY: 0.5 }); var bombTargetCircle = self.attachAsset('bombTarget', { anchorX: 0.5, anchorY: 0.5 }); bombTargetCircle.y = -400; // Position much further in front of the jet bombTargetCircle.alpha = 0.6; bombTargetCircle.visible = false; self.bombTargetCircle = bombTargetCircle; self.lives = 3; self.flareCount = 3; self.maxFlares = 3; self.flareRechargeTimer = 0; self.aaSystemsDestroyed = 0; self.update = function () { // Recharge flares over time if (self.flareCount < self.maxFlares) { self.flareRechargeTimer++; if (self.flareRechargeTimer >= 240) { // 4 seconds at 60fps self.flareCount++; self.flareRechargeTimer = 0; updateFlareDisplay(); } } }; return self; }); var Flare = Container.expand(function () { var self = Container.call(this); var flareGraphics = self.attachAsset('flare', { anchorX: 0.5, anchorY: 0.5 }); self.lifespan = 240; // 4 seconds at 60fps self.update = function () { self.lifespan--; // Track nearest missile var nearestMissile = null; var nearestDistance = Infinity; for (var i = 0; i < missiles.length; i++) { var missile = missiles[i]; var dx = missile.x - self.x; var dy = missile.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < nearestDistance) { nearestDistance = distance; nearestMissile = missile; } } // Move towards nearest missile if within tracking range if (nearestMissile && nearestDistance < 300) { var dx = nearestMissile.x - self.x; var dy = nearestMissile.y - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.x += dx / distance * 8; self.y += dy / distance * 8; } } // Destroy flare after 4 seconds no matter what if (self.lifespan <= 0) { self.destroy(); } }; return self; }); var GroundTarget = Container.expand(function (targetType) { var self = Container.call(this); var targetGraphics = self.attachAsset(targetType, { anchorX: 0.5, anchorY: 0.5 }); self.targetType = targetType; self.points = getPointsForTarget(targetType); self.canShootMissiles = targetType === 's300System'; self.missileTimer = 0; self.update = function () { self.y += scrollSpeed; // Random movement for cars and army vans if (self.targetType === 'car' || self.targetType === 'armyVan') { // Much more frequent random horizontal movement if (Math.random() < 0.3) { // 30% chance each frame to change direction var moveDirection = (Math.random() - 0.5) * 12; // Random movement between -6 and 6 self.x += moveDirection; // Keep vehicles within screen bounds if (self.x < 50) self.x = 50; if (self.x > 1998) self.x = 1998; } // Random vertical movement variation if (Math.random() < 0.15) { // 15% chance each frame for vertical movement var verticalMove = (Math.random() - 0.5) * 6; // Random vertical movement between -3 and 3 self.y += verticalMove; } } // S-300 systems shoot missiles at the player if (self.canShootMissiles && self.y > 200 && self.y < 2000) { self.missileTimer++; if (self.missileTimer >= 180) { // Every 3 seconds self.fireMissile(); self.missileTimer = 0; } } }; self.fireMissile = function () { var missile = new Missile(); missile.x = self.x; missile.y = self.y; missile.targetX = fighterJet.x; missile.targetY = fighterJet.y; missiles.push(missile); game.addChild(missile); LK.getSound('missile').play(); }; return self; }); var Missile = Container.expand(function () { var self = Container.call(this); var missileGraphics = self.attachAsset('missile', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 6; self.targetX = 0; self.targetY = 0; self.lastX = 0; self.lastY = 0; self.stuckTimer = 0; self.bottomTimer = 0; // Track time spent in bottom area self.lifeTimer = 600; // 10 seconds at 60fps self.update = function () { // Decrease lifespan timer self.lifeTimer--; if (self.lifeTimer <= 0) { self.destroy(); return; } // Track last position to detect if missile is stuck var moveThreshold = 2; // Minimum movement required var dx = Math.abs(self.x - self.lastX); var dy = Math.abs(self.y - self.lastY); var totalMovement = dx + dy; // If missile hasn't moved enough, increment stuck timer if (totalMovement < moveThreshold) { self.stuckTimer++; } else { self.stuckTimer = 0; // Reset timer if missile is moving } // If stuck for more than 3 seconds (180 frames at 60fps), mark for destruction if (self.stuckTimer >= 180) { self.destroy(); return; } // Check if missile is in bottom 20% of screen (2732 * 0.8 = 2185.6) if (self.y > 2185) { self.bottomTimer++; } else { self.bottomTimer = 0; // Reset timer if missile leaves bottom area } // If missile has been in bottom area for more than 3 seconds (180 frames at 60fps), mark for destruction if (self.bottomTimer >= 180) { self.destroy(); return; } // Store current position for next frame comparison self.lastX = self.x; self.lastY = self.y; // Move towards target (fighter jet) var dx = self.targetX - self.x; var dy = self.targetY - self.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance > 0) { self.x += dx / distance * self.speed; self.y += dy / distance * self.speed; } }; return self; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0xc19a6b }); /**** * Game Code ****/ var fighterJet = game.addChild(new FighterJet()); fighterJet.x = 1024; fighterJet.y = 2200; var bullets = []; var bombs = []; var flares = []; var missiles = []; var groundTargets = []; var explosions = []; var destructionMarks = []; var scrollSpeed = 3; var spawnTimer = 0; var gameSpeed = 1; var bombKeyPressed = false; var flareKeyPressed = false; var keyStates = {}; var fKeyPressed = false; var bKeyPressed = false; var lastMouseX = 0; var lastMouseY = 0; // Store bomb target position when bomb is released var bombTargetX = 0; var bombTargetY = 0; var bombCooldown = 0; var bombingActive = true; var bombTargetMarked = false; // UI Elements var scoreText = new Text2('Score: 0', { size: 60, fill: '#ffffff' }); scoreText.anchor.set(0, 0); scoreText.x = 150; scoreText.y = 50; LK.gui.topLeft.addChild(scoreText); var livesText = new Text2('Lives: 3', { size: 60, fill: '#ffffff' }); livesText.anchor.set(1, 0); LK.gui.topRight.addChild(livesText); var flareText = new Text2('Flares: 3', { size: 60, fill: '#ffffff' }); flareText.anchor.set(0.5, 0); LK.gui.top.addChild(flareText); var bombingText = new Text2('Bombing: Active', { size: 60, fill: '#ffffff' }); bombingText.anchor.set(0.5, 0); bombingText.y = 70; LK.gui.top.addChild(bombingText); function updateScore() { scoreText.setText('Score: ' + LK.getScore()); } function updateLivesDisplay() { livesText.setText('Lives: ' + fighterJet.lives); } function updateFlareDisplay() { flareText.setText('Flares: ' + fighterJet.flareCount); } function updateBombingDisplay() { bombingText.setText('Bombing: ' + (bombingActive ? 'Active' : 'Disabled')); } function getPointsForTarget(targetType) { switch (targetType) { case 'building': return 10; case 'targetBuilding': return 25; case 'car': return 15; case 'armyVan': return 20; case 's300System': return 50; default: return 10; } } function spawnGroundTarget() { var rand = Math.random(); var randomType; // Make S-300 and target buildings more common if (rand < 0.15) { // 15% chance randomType = 's300System'; } else if (rand < 0.3) { // 15% chance randomType = 'targetBuilding'; } else if (rand < 0.55) { // 25% chance randomType = 'building'; } else if (rand < 0.775) { // 22.5% chance randomType = 'car'; } else { // 22.5% chance randomType = 'armyVan'; } var target = new GroundTarget(randomType); target.x = Math.random() * 1800 + 124; // Keep within screen bounds target.y = -100; groundTargets.push(target); game.addChild(target); } function createExplosion(x, y) { var explosion = new Explosion(); explosion.x = x; explosion.y = y; explosions.push(explosion); game.addChild(explosion); LK.getSound('explosion').play(); } function checkMissileFlareCollision(missile) { for (var f = flares.length - 1; f >= 0; f--) { var flare = flares[f]; if (missile.intersects(flare)) { // Flare explodes and destroys missiles in radius createExplosion(flare.x, flare.y); // Destroy all missiles within explosion radius for (var m = missiles.length - 1; m >= 0; m--) { var targetMissile = missiles[m]; var dx = targetMissile.x - flare.x; var dy = targetMissile.y - flare.y; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 150) { // Explosion radius createExplosion(targetMissile.x, targetMissile.y); targetMissile.destroy(); missiles.splice(m, 1); } } flare.destroy(); flares.splice(f, 1); return true; } } return false; } // Event handlers game.move = function (x, y, obj) { fighterJet.x = x; fighterJet.y = y; // Improved keyboard input simulation with better detection var deltaX = Math.abs(x - lastMouseX); var deltaY = Math.abs(y - lastMouseY); // F key simulation: horizontal movement with more sensitive detection if (deltaX > 30 && deltaY < 30) { fKeyPressed = true; } else { fKeyPressed = false; } // B key simulation: vertical movement with more sensitive detection if (deltaY > 30 && deltaX < 30) { bKeyPressed = true; } else { bKeyPressed = false; } lastMouseX = x; lastMouseY = y; }; game.down = function (x, y, obj) { // Check for special input zones for keyboard simulation if (y < 200 && x < 300) { // Top-left corner click - fire flare (F key simulation) if (fighterJet.flareCount > 0) { var flare = new Flare(); flare.x = fighterJet.x + (Math.random() - 0.5) * 100; flare.y = fighterJet.y + (Math.random() - 0.5) * 100; flares.push(flare); game.addChild(flare); fighterJet.flareCount--; updateFlareDisplay(); LK.getSound('flare').play(); } return; } else if (y < 200 && x > 1748) { // Top-right corner click - drop bomb (B key simulation) var bomb = new Bomb(); bomb.x = fighterJet.x; bomb.y = fighterJet.y + 50; bombs.push(bomb); game.addChild(bomb); LK.getSound('bomb').play(); return; } if (obj.event && obj.event.button === 0) { // Left click - fire bullet var bullet = new Bullet(); bullet.x = fighterJet.x; bullet.y = fighterJet.y - 50; bullets.push(bullet); game.addChild(bullet); LK.getSound('shoot').play(); } else if (obj.event && obj.event.button === 2) { // Right click - drop bomb var bomb = new Bomb(); bomb.x = fighterJet.x; bomb.y = fighterJet.y + 50; bombs.push(bomb); game.addChild(bomb); LK.getSound('bomb').play(); } else if (!obj.event) { // Default action for touch/tap (no event object) - fire bullet var bullet = new Bullet(); bullet.x = fighterJet.x; bullet.y = fighterJet.y - 50; bullets.push(bullet); game.addChild(bullet); LK.getSound('shoot').play(); } }; game.update = function () { // Handle keyboard input - using LK tick-based simulation // Since document is not available, we'll use mouse position changes to detect special actions var currentFlareKeyPressed = false; // Will be triggered by specific mouse positions var currentBombKeyPressed = false; // Will be triggered by specific mouse positions // Fire flare on F key press (only once per press) if (fKeyPressed && !flareKeyPressed && fighterJet.flareCount > 0) { var flare = new Flare(); flare.x = fighterJet.x + (Math.random() - 0.5) * 100; flare.y = fighterJet.y + (Math.random() - 0.5) * 100; flares.push(flare); game.addChild(flare); fighterJet.flareCount--; updateFlareDisplay(); LK.getSound('flare').play(); } flareKeyPressed = fKeyPressed; // Handle bomb cooldown if (bombCooldown > 0) { bombCooldown--; if (bombCooldown === 0) { bombingActive = true; updateBombingDisplay(); } } // Drop bomb on B key press (only once per press) if (bKeyPressed && !bombKeyPressed && bombingActive) { if (!bombTargetMarked) { // Calculate exact target position based on circle's current position, 55 pixels behind bombTargetX = fighterJet.x + fighterJet.bombTargetCircle.x; bombTargetY = fighterJet.y + fighterJet.bombTargetCircle.y + 60; bombTargetMarked = true; // Create and drop the bomb var bomb = new Bomb(); bomb.x = fighterJet.x; bomb.y = fighterJet.y + 50; bomb.targetX = bombTargetX; bomb.targetY = bombTargetY; // Animate bomb falling to target position tween(bomb, { x: bombTargetX, y: bombTargetY }, { duration: 2000, easing: tween.easeIn, onFinish: function onFinish() { // Create big explosion at exact target createExplosion(bombTargetX, bombTargetY); // Create persistent destruction mark var destructionMark = new DestructionMark(); destructionMark.x = bombTargetX; destructionMark.y = bombTargetY; destructionMarks.push(destructionMark); game.addChild(destructionMark); // Destroy ground targets in explosion radius for (var gt = groundTargets.length - 1; gt >= 0; gt--) { var target = groundTargets[gt]; var dx = target.x - bombTargetX; var dy = target.y - bombTargetY; var distance = Math.sqrt(dx * dx + dy * dy); if (distance < 200) { // Big explosion radius createExplosion(target.x, target.y); LK.setScore(LK.getScore() + target.points); updateScore(); if (target.targetType === 's300System') { fighterJet.aaSystemsDestroyed++; if (fighterJet.aaSystemsDestroyed >= 5 && fighterJet.lives < 3) { fighterJet.lives++; fighterJet.aaSystemsDestroyed = 0; updateLivesDisplay(); } } target.destroy(); groundTargets.splice(gt, 1); } } // Remove and destroy the bomb after explosion bomb.destroy(); for (var i = bombs.length - 1; i >= 0; i--) { if (bombs[i] === bomb) { bombs.splice(i, 1); break; } } // Start cooldown bombCooldown = 120; // 2 seconds at 60fps bombingActive = false; bombTargetMarked = false; updateBombingDisplay(); } }); bombs.push(bomb); game.addChild(bomb); LK.getSound('bomb').play(); } } bombKeyPressed = bKeyPressed; spawnTimer++; // Spawn new ground targets if (spawnTimer >= 60) { // Every second spawnGroundTarget(); spawnTimer = 0; } // Show bomb target circle when mouse is in bombing position if (fighterJet.y < 2500) { fighterJet.bombTargetCircle.visible = true; } else { fighterJet.bombTargetCircle.visible = false; } // Update bullets for (var b = bullets.length - 1; b >= 0; b--) { var bullet = bullets[b]; if (bullet.y < -50) { bullet.destroy(); bullets.splice(b, 1); continue; } // Check bullet vs ground targets - only S-300 systems and target buildings can be destroyed by bullets for (var gt = groundTargets.length - 1; gt >= 0; gt--) { var target = groundTargets[gt]; if (bullet.intersects(target)) { // Only destroy S-300 systems and target buildings with bullets if (target.targetType === 's300System' || target.targetType === 'targetBuilding') { createExplosion(target.x, target.y); LK.setScore(LK.getScore() + target.points); updateScore(); bullet.destroy(); bullets.splice(b, 1); target.destroy(); groundTargets.splice(gt, 1); break; } else { // Bullet hits regular car or building - deduct points but don't destroy target if (target.targetType === 'car' || target.targetType === 'building') { var penalty = target.targetType === 'building' ? 3 : target.points; LK.setScore(LK.getScore() - penalty); updateScore(); } bullet.destroy(); bullets.splice(b, 1); break; } } } } // Update bombs - cleanup only for (var bo = bombs.length - 1; bo >= 0; bo--) { var bomb = bombs[bo]; if (bomb.destroyed) { bombs.splice(bo, 1); } } // Update missiles for (var m = missiles.length - 1; m >= 0; m--) { var missile = missiles[m]; // Skip if missile doesn't exist (already removed) if (!missile) { continue; } // Update missile target to current fighter jet position missile.targetX = fighterJet.x; missile.targetY = fighterJet.y; // Check if missile was intercepted by flare if (checkMissileFlareCollision(missile)) { missiles.splice(m, 1); continue; } // Check missile vs fighter jet (only the jet graphics, not the targeting circle) // Calculate distance to jet center for more precise collision var dx = missile.x - fighterJet.x; var dy = missile.y - fighterJet.y; var distance = Math.sqrt(dx * dx + dy * dy); // Only consider collision if missile is close to the actual jet (not the targeting circle) if (distance < 60) { // Jet is 120x80, so radius of ~60 should cover the jet body createExplosion(fighterJet.x, fighterJet.y); fighterJet.lives--; updateLivesDisplay(); if (fighterJet.lives <= 0) { LK.showGameOver(); return; } missile.destroy(); missiles.splice(m, 1); continue; } // Remove missiles that go off screen if (missile.y > 2800 || missile.y < -50 || missile.x < -50 || missile.x > 2100) { missile.destroy(); missiles.splice(m, 1); } } // Update ground targets for (var gt = groundTargets.length - 1; gt >= 0; gt--) { var target = groundTargets[gt]; if (target.y > 2800) { target.destroy(); groundTargets.splice(gt, 1); } } // Update flares for (var f = flares.length - 1; f >= 0; f--) { var flare = flares[f]; if (flare.destroyed) { flares.splice(f, 1); } } // Update explosions for (var e = explosions.length - 1; e >= 0; e--) { var explosion = explosions[e]; if (explosion.destroyed) { explosions.splice(e, 1); } } // Update destruction marks for (var dm = destructionMarks.length - 1; dm >= 0; dm--) { var destructionMark = destructionMarks[dm]; if (destructionMark.y > 2800) { destructionMark.destroy(); destructionMarks.splice(dm, 1); } } };
===================================================================
--- original.js
+++ change.js
@@ -167,28 +167,26 @@
self.targetType = targetType;
self.points = getPointsForTarget(targetType);
self.canShootMissiles = targetType === 's300System';
self.missileTimer = 0;
- // Set random movement direction for vehicles (only once at creation)
- if (targetType === 'car' || targetType === 'armyVan') {
- self.moveDirection = (Math.random() - 0.5) * 8; // Random direction between -4 and 4
- } else {
- self.moveDirection = 0;
- }
self.update = function () {
self.y += scrollSpeed;
- // Movement for cars and army vans in one consistent direction
+ // Random movement for cars and army vans
if (self.targetType === 'car' || self.targetType === 'armyVan') {
- // Move consistently in the chosen direction
- self.x += self.moveDirection;
- // Keep vehicles within screen bounds and reverse direction if hitting edges
- if (self.x < 50) {
- self.x = 50;
- self.moveDirection = Math.abs(self.moveDirection); // Force positive direction
+ // Much more frequent random horizontal movement
+ if (Math.random() < 0.3) {
+ // 30% chance each frame to change direction
+ var moveDirection = (Math.random() - 0.5) * 12; // Random movement between -6 and 6
+ self.x += moveDirection;
+ // Keep vehicles within screen bounds
+ if (self.x < 50) self.x = 50;
+ if (self.x > 1998) self.x = 1998;
}
- if (self.x > 1998) {
- self.x = 1998;
- self.moveDirection = -Math.abs(self.moveDirection); // Force negative direction
+ // Random vertical movement variation
+ if (Math.random() < 0.15) {
+ // 15% chance each frame for vertical movement
+ var verticalMove = (Math.random() - 0.5) * 6; // Random vertical movement between -3 and 3
+ self.y += verticalMove;
}
}
// S-300 systems shoot missiles at the player
if (self.canShootMissiles && self.y > 200 && self.y < 2000) {
@@ -618,34 +616,33 @@
bullet.destroy();
bullets.splice(b, 1);
continue;
}
- // Check bullet vs ground targets
+ // Check bullet vs ground targets - only S-300 systems and target buildings can be destroyed by bullets
for (var gt = groundTargets.length - 1; gt >= 0; gt--) {
var target = groundTargets[gt];
if (bullet.intersects(target)) {
- // Only allow bullets to destroy certain targets - not S-300 or missile buildings
+ // Only destroy S-300 systems and target buildings with bullets
if (target.targetType === 's300System' || target.targetType === 'targetBuilding') {
- // Bullets cannot destroy S-300 systems or missile buildings
+ createExplosion(target.x, target.y);
+ LK.setScore(LK.getScore() + target.points);
+ updateScore();
bullet.destroy();
bullets.splice(b, 1);
+ target.destroy();
+ groundTargets.splice(gt, 1);
break;
- }
- createExplosion(target.x, target.y);
- // Deduct points for hitting regular cars and buildings, add points for military targets
- if (target.targetType === 'car' || target.targetType === 'building') {
- // Reduce penalty for buildings, keep full penalty for cars
- var penalty = target.targetType === 'building' ? 3 : target.points;
- LK.setScore(LK.getScore() - penalty);
} else {
- LK.setScore(LK.getScore() + target.points);
+ // Bullet hits regular car or building - deduct points but don't destroy target
+ if (target.targetType === 'car' || target.targetType === 'building') {
+ var penalty = target.targetType === 'building' ? 3 : target.points;
+ LK.setScore(LK.getScore() - penalty);
+ updateScore();
+ }
+ bullet.destroy();
+ bullets.splice(b, 1);
+ break;
}
- updateScore();
- bullet.destroy();
- bullets.splice(b, 1);
- target.destroy();
- groundTargets.splice(gt, 1);
- break;
}
}
}
// Update bombs - cleanup only
B-2 bombing jet. In-Game asset. 2d. High contrast. No shadows
S-300 Anti Air system from the bird view. In-Game asset. 2d. High contrast. No shadows
Hi-Teck buikding. In-Game asset. 2d. High contrast. No shadows
Tiny missile pointing up. In-Game asset. 2d. High contrast. No shadows
Strait anti air missile. In-Game asset. 2d. High contrast. No shadows
strait flare missile. In-Game asset. 2d. High contrast. No shadows
WW2 bomb. In-Game asset. 2d. High contrast. No shadows
Army building. In-Game asset. 2d. High contrast. No shadows
רכב צבאי ארוך וגדול, כמו תובלתית, מכוסה בברזנט, מבט מהפרופיל.
Missiles storage. In-Game asset. 2d. High contrast. No shadows
מתקן ענק לשיגור טיל שעליו מוכן טיל גרעיני. In-Game asset. 2d. High contrast. No shadows