User prompt
2 yönlü atışta sağ ve sol tarafa atış olsun yani 2 li olsun 3 lü gibi değil
User prompt
200 puandan sonra 2 li yaylım ateşi özelliği ekle standart atış bu olsun
User prompt
Boss savaşını kaldır
User prompt
Mermi türü yazı olarak değil simge olarak eklensin
User prompt
Can ödülü 50 puanda bir gelsin
User prompt
Bomba 50 puanda bir çıksın
User prompt
Bomba sadece yakın çevresini imha etsin tüm ekranı değil
User prompt
200 puandan sonra gelen düşman sayısı artmasın düşmanların canı orantılı olarak artsın
User prompt
Her 200 puanda bir düşman sayısını artırmak yerine orantılı olarak düşman canını artır
User prompt
Patlama efektini sadece düşmanlar üzerinde ekle ekran yanıp sönmesin
User prompt
Can kazanma için bir yöntem ekle
User prompt
Oyundaki assetleri yüzde 20 büyüt
User prompt
Bomba için patlama efekti kullan
User prompt
Arka plan için ayrı asset ekle
User prompt
Bomba atıldığında ekrandaki tüm düşmanlar yok edilsin
User prompt
Bomba çalışmıyor neden
User prompt
Bomba sadece 30 puanda bir gelsin
User prompt
Bomba atışı 50 puanda bir olsun
User prompt
Yeni bir atış özelliği ekle= bomba
User prompt
6 lı atış özelliğini kaldır
User prompt
Oyunda tekli ateş yazarken 6 lı ateş var düzelt bunu
User prompt
50 puanda bir 6 lı yayılı ateş yap
User prompt
Bu atış sistemini sen daha kullanışlı hale getir
User prompt
Bu yeni sistemi 100 puan ve katlarında ver
User prompt
Yeni bir atış sistemi ekle bu da dikey 3 lü ve etrafa dağılan 3 lü atış şeklinde olsun
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Enemy Class
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemy = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.width = enemy.width;
self.height = enemy.height;
self.speed = 3 + Math.random() * 2; // Downwards, slower and less random
self.type = 0; // 0: normal, 1: zigzag, 2: shooter
self.dir = Math.random() < 0.5 ? -1 : 1; // for zigzag
self.shootCooldown = 0;
self.update = function () {
if (self.type === 1) {
// Zigzag
self.x += self.dir * 12 * Math.sin(LK.ticks / 20 + self._zigzagSeed);
}
self.y += self.speed;
// Shooter
if (self.type === 2) {
self.shootCooldown--;
if (self.shootCooldown <= 0) {
self.shootCooldown = 90 + Math.floor(Math.random() * 60);
spawnEnemyBullet(self.x, self.y + self.height / 2);
}
}
};
// For zigzag
self._zigzagSeed = Math.random() * 1000;
// Flash on hit
self.flash = function () {
tween(enemy, {
tint: 0xffffff
}, {
duration: 80,
onFinish: function onFinish() {
tween(enemy, {
tint: 0xff3333
}, {
duration: 120
});
}
});
};
enemy.tint = 0xff3333;
return self;
});
// Enemy Bullet Class
var EnemyBullet = Container.expand(function () {
var self = Container.call(this);
var bullet = self.attachAsset('enemyBullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 18; // Downwards
self.update = function () {
self.y += self.speed;
};
return self;
});
// Hero Bullet Class
var HeroBullet = Container.expand(function () {
var self = Container.call(this);
var bullet = self.attachAsset('heroBullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -32; // Upwards
self.angle = 0; // Default straight up, can be set externally
self.update = function () {
// Move in direction of angle (angle 0 = straight up)
self.x += Math.sin(self.angle) * Math.abs(self.speed);
self.y += Math.cos(self.angle) * self.speed;
};
return self;
});
// Hero Ship Class
var HeroShip = Container.expand(function () {
var self = Container.call(this);
// Attach ship asset (box, blue)
var ship = self.attachAsset('heroShip', {
anchorX: 0.5,
anchorY: 0.5
});
// Ship properties
self.width = ship.width;
self.height = ship.height;
self.cooldown = 0; // fire cooldown
// Ship hit flash
self.flash = function () {
tween(ship, {
tint: 0xff0000
}, {
duration: 100,
onFinish: function onFinish() {
tween(ship, {
tint: 0x3399ff
}, {
duration: 200
});
}
});
};
// Ship reset color
ship.tint = 0x3399ff;
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000010
});
/****
* Game Code
****/
// Score text
// Asset definitions (shapes)
var scoreTxt = new Text2('0', {
size: 120,
fill: 0xFFFFFF
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Game variables
var hero = null;
var heroBullets = [];
var enemies = [];
var enemyBullets = [];
var dragNode = null;
var lastHeroX = 0;
var lastHeroY = 0;
var spawnTimer = 0;
var wave = 1;
var nextWaveScore = 10;
var gameOver = false;
// 6-way shot tracker
var lastSixWayScore = -1;
// Spread shot power-up state
var spreadShotActive = false;
var spreadShotTimer = 0;
// New: Firing mode state
// 0: single, 1: vertical 3-way, 2: wide 3-way
var firingModes = [0]; // Array of active firing modes, 0 always present
var firingModeTimers = [0]; // Timers for each mode (0 = infinite for base)
var firingMode = 0; // Current selected mode
var firingModeSwitchCooldown = 0; // Prevent rapid switching
// Player lives
var heroLives = 3;
var livesTxt = new Text2('♥♥♥', {
size: 100,
fill: 0xFF4444
});
livesTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(livesTxt);
livesTxt.x = 2048 / 2 - 400;
// Helper: spawn hero bullet
function spawnHeroBullet(x, y, angle) {
var b = new HeroBullet();
b.x = x;
b.y = y - hero.height / 2;
// If angle is provided, set it for spread, otherwise 0 (straight up)
b.angle = angle || 0;
heroBullets.push(b);
game.addChild(b);
}
// Helper: activate spread shot power-up for a duration (in frames)
function activateSpreadShot(duration) {
spreadShotActive = true;
spreadShotTimer = duration;
}
// Helper: activate vertical 3-way shot for a duration (in frames)
function activateVertical3Way(duration) {
// Add or refresh vertical 3-way mode in firingModes
var idx = firingModes.indexOf(1);
if (idx === -1) {
firingModes.push(1);
firingModeTimers.push(duration);
} else {
firingModeTimers[idx] = duration;
}
}
// Helper: activate wide 3-way spread shot for a duration (in frames)
function activateWide3Way(duration) {
// Add or refresh wide 3-way mode in firingModes
var idx = firingModes.indexOf(2);
if (idx === -1) {
firingModes.push(2);
firingModeTimers.push(duration);
} else {
firingModeTimers[idx] = duration;
}
}
// Helper: spawn enemy bullet
function spawnEnemyBullet(x, y) {
var b = new EnemyBullet();
b.x = x;
b.y = y;
enemyBullets.push(b);
game.addChild(b);
}
// Helper: spawn enemy
function spawnEnemy(type, x, y) {
var e = new Enemy();
e.x = x;
e.y = y;
e.type = type;
if (type === 2) {
e.shootCooldown = 60 + Math.floor(Math.random() * 60);
}
enemies.push(e);
game.addChild(e);
}
// Helper: spawn wave
function spawnWave(waveNum) {
var count = 3 + waveNum;
var spacing = 2048 / (count + 1);
for (var i = 0; i < count; i++) {
var type = 0;
if (waveNum >= 2 && i % 3 === 0) type = 1; // zigzag
if (waveNum >= 3 && i % 4 === 0) type = 2; // shooter
spawnEnemy(type, spacing * (i + 1), -150 - Math.random() * 200);
}
}
// Reset game state
function resetGame() {
// Remove all
for (var i = 0; i < heroBullets.length; i++) heroBullets[i].destroy();
for (var i = 0; i < enemies.length; i++) enemies[i].destroy();
for (var i = 0; i < enemyBullets.length; i++) enemyBullets[i].destroy();
heroBullets = [];
enemies = [];
enemyBullets = [];
wave = 1;
nextWaveScore = 10;
LK.setScore(0);
scoreTxt.setText('0');
gameOver = false;
// Reset 6-way shot tracker
lastSixWayScore = -1;
// Reset lives
heroLives = 3;
livesTxt.setText('♥'.repeat(heroLives));
// Reset spread shot
spreadShotActive = false;
spreadShotTimer = 0;
// Reset firing mode
firingModes = [0];
firingModeTimers = [0];
firingMode = 0;
firingModeSwitchCooldown = 0;
// Hero
if (hero) hero.destroy();
hero = new HeroShip();
hero.x = 2048 / 2;
hero.y = 2732 - 220;
game.addChild(hero);
// First wave
spawnWave(wave);
// Firing mode label
if (typeof firingModeTxt !== "undefined" && firingModeTxt.parent) firingModeTxt.parent.removeChild(firingModeTxt);
firingModeTxt = new Text2('', {
size: 60,
fill: 0xFFFF00
});
firingModeTxt.anchor.set(0.5, 1);
game.addChild(firingModeTxt);
}
// Drag/move handler
function handleMove(x, y, obj) {
if (dragNode && !gameOver) {
// Clamp inside screen
var minX = hero.width / 2;
var maxX = 2048 - hero.width / 2;
dragNode.x = Math.max(minX, Math.min(maxX, x));
// Y is fixed (bottom)
dragNode.y = hero.y;
}
}
// Touch/drag events
game.down = function (x, y, obj) {
if (gameOver) return;
// Only allow drag if touch is on hero
var local = hero.toLocal(game.toGlobal({
x: x,
y: y
}));
if (local.x > -hero.width / 2 && local.x < hero.width / 2 && local.y > -hero.height / 2 && local.y < hero.height / 2) {
// If multiple firing modes, tap to switch
if (firingModes.length > 1 && firingModeSwitchCooldown === 0) {
var idx = firingModes.indexOf(firingMode);
idx = (idx + 1) % firingModes.length;
firingMode = firingModes[idx];
firingModeSwitchCooldown = 15; // prevent rapid switching
} else {
dragNode = hero;
handleMove(x, y, obj);
}
}
};
game.up = function (x, y, obj) {
dragNode = null;
};
game.move = handleMove;
// Main update loop
game.update = function () {
if (gameOver) return;
// Hero fire
if (hero.cooldown > 0) hero.cooldown--;
if (hero.cooldown <= 0) {
// Use current firingMode from stack
if (firingMode === 2) {
// Wide 3-way spread: center, wide left, wide right
var wideAngle = 32 * Math.PI / 180; // 32 degrees in radians
spawnHeroBullet(hero.x, hero.y - hero.height / 2, 0);
spawnHeroBullet(hero.x, hero.y - hero.height / 2, -wideAngle);
spawnHeroBullet(hero.x, hero.y - hero.height / 2, wideAngle);
} else if (firingMode === 1) {
// Vertical 3-way: center, slightly left, slightly right (all nearly vertical)
var vAngle = 8 * Math.PI / 180; // 8 degrees in radians
spawnHeroBullet(hero.x, hero.y - hero.height / 2, 0);
spawnHeroBullet(hero.x, hero.y - hero.height / 2, -vAngle);
spawnHeroBullet(hero.x, hero.y - hero.height / 2, vAngle);
} else if (spreadShotActive) {
// 3-way spread: center, left, right (legacy power-up)
var spreadAngle = 18 * Math.PI / 180; // 18 degrees in radians
spawnHeroBullet(hero.x, hero.y - hero.height / 2, 0);
spawnHeroBullet(hero.x, hero.y - hero.height / 2, -spreadAngle);
spawnHeroBullet(hero.x, hero.y - hero.height / 2, spreadAngle);
} else {
// Single straight bullet
spawnHeroBullet(hero.x, hero.y - hero.height / 2, 0);
}
hero.cooldown = 18;
}
// Spread shot timer countdown
if (spreadShotActive) {
spreadShotTimer--;
if (spreadShotTimer <= 0) {
spreadShotActive = false;
}
}
// Firing mode timers countdown and cleanup
for (var i = firingModes.length - 1; i > 0; i--) {
// skip base mode at 0
firingModeTimers[i]--;
if (firingModeTimers[i] <= 0) {
// Remove expired mode
if (firingMode === firingModes[i]) {
firingMode = 0; // fallback to base
}
firingModes.splice(i, 1);
firingModeTimers.splice(i, 1);
}
}
// Clamp firingMode to available
if (firingModes.indexOf(firingMode) === -1) firingMode = firingModes[0];
// Firing mode switch cooldown
if (firingModeSwitchCooldown > 0) firingModeSwitchCooldown--;
// Update hero bullets
for (var i = heroBullets.length - 1; i >= 0; i--) {
var b = heroBullets[i];
b.update();
// Off screen
if (b.y < -80) {
b.destroy();
heroBullets.splice(i, 1);
continue;
}
// Hit enemy
var hit = false;
for (var j = enemies.length - 1; j >= 0; j--) {
var e = enemies[j];
if (b.intersects(e)) {
e.flash();
b.destroy();
heroBullets.splice(i, 1);
enemies.splice(j, 1);
e.destroy();
LK.setScore(LK.getScore() + 1);
scoreTxt.setText(LK.getScore());
hit = true;
break;
}
}
if (hit) continue;
}
// Update enemies
for (var i = enemies.length - 1; i >= 0; i--) {
var e = enemies[i];
e.update();
// Off screen
if (e.y > 2732 + 100) {
e.destroy();
enemies.splice(i, 1);
continue;
}
// Collide with hero
if (e.intersects(hero)) {
hero.flash();
LK.effects.flashScreen(0xff0000, 1000);
heroLives--;
livesTxt.setText('♥'.repeat(heroLives));
if (heroLives <= 0) {
gameOver = true;
LK.showGameOver();
return;
} else {
// Remove enemy and continue
e.destroy();
enemies.splice(i, 1);
continue;
}
}
}
// Update enemy bullets
for (var i = enemyBullets.length - 1; i >= 0; i--) {
var b = enemyBullets[i];
b.update();
// Off screen
if (b.y > 2732 + 80) {
b.destroy();
enemyBullets.splice(i, 1);
continue;
}
// Hit hero
if (b.intersects(hero)) {
hero.flash();
b.destroy();
enemyBullets.splice(i, 1);
LK.effects.flashScreen(0xff0000, 1000);
heroLives--;
livesTxt.setText('♥'.repeat(heroLives));
if (heroLives <= 0) {
gameOver = true;
LK.showGameOver();
return;
}
}
}
// Spawn new wave if all enemies gone
if (enemies.length === 0) {
wave++;
spawnWave(wave);
}
// Next wave at score milestones
if (LK.getScore() >= nextWaveScore) {
wave++;
nextWaveScore += 10 + wave * 2;
spawnWave(wave);
}
// Reward: Activate different firing modes at score milestones
// Every 100: vertical 3-way, every 200: wide 3-way
if (LK.getScore() > 0 && LK.getScore() % 200 === 0 && firingModes.indexOf(2) === -1) {
activateWide3Way(360);
} else if (LK.getScore() > 0 && LK.getScore() % 100 === 0 && firingModes.indexOf(1) === -1) {
activateVertical3Way(360);
} else if (LK.getScore() > 0 && LK.getScore() % 20 === 0 && !spreadShotActive && firingModes.length === 1) {
activateSpreadShot(360);
}
// 6-way spread shot at every 50 points (visual burst, not a mode)
if (LK.getScore() > 0 && LK.getScore() % 50 === 0 && typeof lastSixWayScore !== "number" || lastSixWayScore !== LK.getScore()) {
// Fire 6 bullets in a spread
var baseAngle = 0;
var spread = 48 * Math.PI / 180; // total spread (48 deg)
var count = 6;
for (var i = 0; i < count; i++) {
var angle = baseAngle + (i - (count - 1) / 2) * (spread / (count - 1));
spawnHeroBullet(hero.x, hero.y - hero.height / 2, angle);
}
lastSixWayScore = LK.getScore();
}
// Update firing mode label
if (typeof firingModeTxt !== "undefined" && firingModeTxt) {
firingModeTxt.x = hero.x;
firingModeTxt.y = hero.y - hero.height / 2 - 20;
var label = "Tekli";
if (typeof lastSixWayScore === "number" && lastSixWayScore === LK.getScore() && LK.getScore() > 0 && LK.getScore() % 50 === 0) {
label = "6'lı Yayılı";
} else if (firingMode === 1) {
label = "Dikey 3'lü";
} else if (firingMode === 2) {
label = "Geniş 3'lü";
} else if (spreadShotActive) {
label = "Yayılı 3'lü";
}
firingModeTxt.setText(label);
}
};
// Start game
resetGame(); ===================================================================
--- original.js
+++ change.js
@@ -144,8 +144,10 @@
var spawnTimer = 0;
var wave = 1;
var nextWaveScore = 10;
var gameOver = false;
+// 6-way shot tracker
+var lastSixWayScore = -1;
// Spread shot power-up state
var spreadShotActive = false;
var spreadShotTimer = 0;
// New: Firing mode state
@@ -244,8 +246,10 @@
nextWaveScore = 10;
LK.setScore(0);
scoreTxt.setText('0');
gameOver = false;
+ // Reset 6-way shot tracker
+ lastSixWayScore = -1;
// Reset lives
heroLives = 3;
livesTxt.setText('♥'.repeat(heroLives));
// Reset spread shot
@@ -464,14 +468,34 @@
activateVertical3Way(360);
} else if (LK.getScore() > 0 && LK.getScore() % 20 === 0 && !spreadShotActive && firingModes.length === 1) {
activateSpreadShot(360);
}
+ // 6-way spread shot at every 50 points (visual burst, not a mode)
+ if (LK.getScore() > 0 && LK.getScore() % 50 === 0 && typeof lastSixWayScore !== "number" || lastSixWayScore !== LK.getScore()) {
+ // Fire 6 bullets in a spread
+ var baseAngle = 0;
+ var spread = 48 * Math.PI / 180; // total spread (48 deg)
+ var count = 6;
+ for (var i = 0; i < count; i++) {
+ var angle = baseAngle + (i - (count - 1) / 2) * (spread / (count - 1));
+ spawnHeroBullet(hero.x, hero.y - hero.height / 2, angle);
+ }
+ lastSixWayScore = LK.getScore();
+ }
// Update firing mode label
if (typeof firingModeTxt !== "undefined" && firingModeTxt) {
firingModeTxt.x = hero.x;
firingModeTxt.y = hero.y - hero.height / 2 - 20;
var label = "Tekli";
- if (firingMode === 1) label = "Dikey 3'lü";else if (firingMode === 2) label = "Geniş 3'lü";else if (spreadShotActive) label = "Yayılı 3'lü";
+ if (typeof lastSixWayScore === "number" && lastSixWayScore === LK.getScore() && LK.getScore() > 0 && LK.getScore() % 50 === 0) {
+ label = "6'lı Yayılı";
+ } else if (firingMode === 1) {
+ label = "Dikey 3'lü";
+ } else if (firingMode === 2) {
+ label = "Geniş 3'lü";
+ } else if (spreadShotActive) {
+ label = "Yayılı 3'lü";
+ }
firingModeTxt.setText(label);
}
};
// Start game