User prompt
Health kits should arrive more frequently, bullets should arrive more frequently, and enemies should arrive slower and less frequently.
User prompt
Let the background be World War I
User prompt
Make the background appear faded
User prompt
Background is Forest war
User prompt
Background is war arena
User prompt
Make the Background in a battlefield style location
User prompt
hp text to upper left
User prompt
move the hp text to the right
User prompt
Separate hp text from score text
User prompt
Asker figürü ekle
Code edit (1 edits merged)
Please save this source code
User prompt
Iron Valor: Warfront Assault
Initial prompt
Game Title: Iron Valor: Warfront Assault 🔥 Description: Lock and load, soldier! Step into the boots of elite commando Captain Rhea Morgan in Iron Valor: Warfront Assault — a high-octane 2D military action game that drops you into the frontlines of a futuristic global conflict. Lead a tactical strike team behind enemy lines, destroy war machines, liberate zones, and uncover the dark truth behind a global AI conspiracy. Whether you're storming desert outposts, battling in snow-covered trenches, or sneaking through enemy bunkers, every mission tests your reflexes, tactics, and courage. 🪖 Key Features: 🔫 Intense 2D War Combat Classic run-and-gun action combined with modern tactical mechanics. Shoot, dodge, throw grenades, and control dron 🎯 Squ Command up to 3 AI soldiers: issue orders like “Hold Positio Upgrade your team with different roles: Medic, Heavy Gunner, Sniper, and more. 💥 Epic Boss Battles Face heavily armored tanks, mech walkers, and flying war drones in multi-phase boss fights. 🛠️ Base and Weapon Upgrades Collect intel and resources to upgrade your base, unlock weapons, and craft gear. Choose from over 25 unique weapons: assault rifles, RPGs, flamethrowers, and EMP launchers. 🌍 Diverse Battle Zones Campaign mode spans 6 war-torn regions: Jungle, Desert, Snowfield, Ruins, Cyber City, and The Final Fortress. Each environment features unique enemies and environmental hazards (mines, gas, falling debris). 🎮 Offline & Controller Support Fully playable offline. Optimized for touch controls & external controllers. 🎖️ Story Summary: In the near future, the world has collapsed into chaos. Mega-corporations and AI armies rule the continents. The last hope for humanity lies with a rogue special ops team led by Captain Morgan, operating from a hidden resistance base. Your mission: destroy Project Vulture, a weaponized AI threatening to wipe out every living human.
/****
* Plugins
****/
var tween = LK.import("@upit/tween.v1");
/****
* Classes
****/
// Enemy: Drone
var Drone = Container.expand(function () {
var self = Container.call(this);
var gfx = self.attachAsset('drone', {
anchorX: 0.5,
anchorY: 0.5
});
self.hp = 1;
self.shootCooldown = 0;
self.update = function () {
self.x -= 8;
};
return self;
});
// Enemy bullet
var EnemyBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGfx = self.attachAsset('bullet_enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -18;
self.update = function () {
self.x += self.speed;
};
return self;
});
// Explosion effect
var Explosion = Container.expand(function () {
var self = Container.call(this);
var gfx = self.attachAsset('explosion', {
anchorX: 0.5,
anchorY: 0.5,
alpha: 1
});
// Animate fade out
tween(gfx, {
alpha: 0
}, {
duration: 400,
easing: tween.linear,
onFinish: function onFinish() {
self.destroy();
}
});
return self;
});
// Squad member: Medic
var Medic = Container.expand(function () {
var self = Container.call(this);
var gfx = self.attachAsset('medic', {
anchorX: 0.5,
anchorY: 0.5
});
self.hp = 3;
self.role = 'medic';
self.update = function () {};
return self;
});
// Player bullet
var PlayerBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGfx = self.attachAsset('bullet_player', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 32;
self.update = function () {
self.x += self.speed;
};
return self;
});
// Powerup: Ammo
var PowerupAmmo = Container.expand(function () {
var self = Container.call(this);
var gfx = self.attachAsset('powerup_ammo', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
self.x -= 6;
};
return self;
});
// Powerup: Health
var PowerupHealth = Container.expand(function () {
var self = Container.call(this);
var gfx = self.attachAsset('powerup_health', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
self.x -= 6;
};
return self;
});
// Captain Rhea Morgan (player)
var Rhea = Container.expand(function () {
var self = Container.call(this);
var gfx = self.attachAsset('rhea', {
anchorX: 0.5,
anchorY: 0.5
});
self.hp = 5;
self.shootCooldown = 0;
self.update = function () {};
return self;
});
// Squad member: Sniper
var Sniper = Container.expand(function () {
var self = Container.call(this);
var gfx = self.attachAsset('sniper', {
anchorX: 0.5,
anchorY: 0.5
});
self.hp = 2;
self.role = 'sniper';
self.shootCooldown = 0;
self.update = function () {};
return self;
});
// Enemy: Tank (mini-boss)
var Tank = Container.expand(function () {
var self = Container.call(this);
var gfx = self.attachAsset('tank', {
anchorX: 0.5,
anchorY: 0.5
});
self.hp = 10;
self.shootCooldown = 0;
self.update = function () {
self.x -= 4;
};
return self;
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x222831
});
/****
* Game Code
****/
// World War I background image
var battlefieldBg = LK.getAsset('ww1_bg', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0,
width: 2048,
height: 2732,
alpha: 0.35
});
game.addChild(battlefieldBg);
// Play music
// Main character: Captain Rhea Morgan
// Squad member: Medic
// Squad member: Sniper
// Enemy: Drone
// Enemy: Tank
// Bullet: Player
// Bullet: Enemy
// Powerup: Health
// Powerup: Ammo
// Explosion effect
// Sound effects
// Music
LK.playMusic('battle_theme');
// Game state variables
var rhea, medic, sniper;
var squad = [];
var playerBullets = [];
var enemyBullets = [];
var enemies = [];
var powerups = [];
var explosions = [];
var score = 0;
var resources = 0;
var gameOver = false;
var youWin = false;
var dragNode = null;
var lastTouchX = 0,
lastTouchY = 0;
// UI
var scoreTxt = new Text2('0', {
size: 100,
fill: "#fff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var hpTxt = new Text2('HP: 5', {
size: 70,
fill: 0xFF5252
});
// Move HP text to the upper left, avoiding the top left 100x100 px reserved area
hpTxt.anchor.set(0, 0);
hpTxt.x = 110; // 10px right of reserved area
hpTxt.y = 10;
LK.gui.topLeft.addChild(hpTxt);
var resourceTxt = new Text2('Res: 0', {
size: 70,
fill: 0xFFD600
});
resourceTxt.anchor.set(1, 0);
LK.gui.topRight.addChild(resourceTxt);
// Initialize player and squad
rhea = new Rhea();
rhea.x = 400;
rhea.y = 2732 / 2;
game.addChild(rhea);
medic = new Medic();
medic.x = rhea.x - 120;
medic.y = rhea.y + 120;
game.addChild(medic);
sniper = new Sniper();
sniper.x = rhea.x - 120;
sniper.y = rhea.y - 120;
game.addChild(sniper);
squad = [rhea, medic, sniper];
// Helper: spawn enemy
function spawnEnemy() {
var type = LK.ticks % 300 === 0 ? 'tank' : 'drone';
var enemy;
if (type === 'drone') {
enemy = new Drone();
enemy.x = 2048 + 60;
enemy.y = 300 + Math.floor(Math.random() * (2732 - 600));
} else {
enemy = new Tank();
enemy.x = 2048 + 120;
enemy.y = 400 + Math.floor(Math.random() * (2732 - 800));
}
enemies.push(enemy);
game.addChild(enemy);
}
// Helper: spawn powerup
function spawnPowerup() {
var type = Math.random() < 0.5 ? 'health' : 'ammo';
var powerup;
if (type === 'health') {
powerup = new PowerupHealth();
} else {
powerup = new PowerupAmmo();
}
powerup.x = 2048 + 60;
powerup.y = 300 + Math.floor(Math.random() * (2732 - 600));
powerups.push(powerup);
game.addChild(powerup);
}
// Helper: fire player bullet
function firePlayerBullet(from) {
var bullet = new PlayerBullet();
bullet.x = from.x + 70;
bullet.y = from.y;
playerBullets.push(bullet);
game.addChild(bullet);
LK.getSound('shoot_player').play();
}
// Helper: fire enemy bullet
function fireEnemyBullet(from) {
var bullet = new EnemyBullet();
bullet.x = from.x - 70;
bullet.y = from.y;
enemyBullets.push(bullet);
game.addChild(bullet);
LK.getSound('shoot_enemy').play();
}
// Helper: show explosion
function showExplosion(x, y) {
var exp = new Explosion();
exp.x = x;
exp.y = y;
explosions.push(exp);
game.addChild(exp);
LK.getSound('explosion').play();
}
// Helper: update UI
function updateUI() {
scoreTxt.setText(score);
hpTxt.setText('HP: ' + rhea.hp);
resourceTxt.setText('Res: ' + resources);
}
// Handle dragging Rhea (player)
function handleMove(x, y, obj) {
if (dragNode) {
// Clamp to game area
var minY = 120,
maxY = 2732 - 120;
dragNode.y = Math.max(minY, Math.min(maxY, y));
lastTouchX = x;
lastTouchY = y;
}
}
game.move = handleMove;
game.down = function (x, y, obj) {
// Only allow dragging Rhea
if (!gameOver && !youWin) {
if (Math.abs(x - rhea.x) < 120 && Math.abs(y - rhea.y) < 120) {
dragNode = rhea;
handleMove(x, y, obj);
}
}
};
game.up = function (x, y, obj) {
dragNode = null;
};
// Main game update loop
game.update = function () {
if (gameOver || youWin) return;
// Player auto-fire
if (rhea.shootCooldown > 0) rhea.shootCooldown--;
if (rhea.shootCooldown === 0) {
firePlayerBullet(rhea);
rhea.shootCooldown = 18;
}
// Sniper auto-fire (slower)
if (sniper.shootCooldown > 0) sniper.shootCooldown--;
if (sniper.shootCooldown === 0) {
firePlayerBullet(sniper);
sniper.shootCooldown = 60;
}
// Medic follows Rhea
medic.x += (rhea.x - 120 - medic.x) * 0.15;
medic.y += (rhea.y + 120 - medic.y) * 0.15;
// Sniper follows Rhea
sniper.x += (rhea.x - 120 - sniper.x) * 0.15;
sniper.y += (rhea.y - 120 - sniper.y) * 0.15;
// Spawn enemies
if (LK.ticks % 60 === 0) {
spawnEnemy();
}
// Spawn powerups
if (LK.ticks % 420 === 0) {
spawnPowerup();
}
// Update player bullets
for (var i = playerBullets.length - 1; i >= 0; i--) {
var b = playerBullets[i];
b.update();
// Remove if off screen
if (b.x > 2048 + 60) {
b.destroy();
playerBullets.splice(i, 1);
continue;
}
// Hit enemy
for (var j = enemies.length - 1; j >= 0; j--) {
var e = enemies[j];
if (b.intersects(e)) {
e.hp--;
showExplosion(b.x, b.y);
b.destroy();
playerBullets.splice(i, 1);
if (e.hp <= 0) {
showExplosion(e.x, e.y);
score += e instanceof Tank ? 10 : 2;
resources += e instanceof Tank ? 5 : 1;
e.destroy();
enemies.splice(j, 1);
}
updateUI();
break;
}
}
}
// Update enemy bullets
for (var i = enemyBullets.length - 1; i >= 0; i--) {
var b = enemyBullets[i];
b.update();
if (b.x < -60) {
b.destroy();
enemyBullets.splice(i, 1);
continue;
}
// Hit squad
for (var j = 0; j < squad.length; j++) {
var s = squad[j];
if (b.intersects(s)) {
s.hp--;
showExplosion(b.x, b.y);
b.destroy();
enemyBullets.splice(i, 1);
if (s.hp <= 0) {
showExplosion(s.x, s.y);
if (s === rhea) {
// Game over
gameOver = true;
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
return;
} else {
s.destroy();
squad.splice(j, 1);
}
}
updateUI();
break;
}
}
}
// Update enemies
for (var i = enemies.length - 1; i >= 0; i--) {
var e = enemies[i];
e.update();
// Remove if off screen
if (e.x < -200) {
e.destroy();
enemies.splice(i, 1);
continue;
}
// Enemy fire
if (e.shootCooldown > 0) e.shootCooldown--;
if (e.shootCooldown === 0) {
// Only fire if on screen
if (e.x < 2048 && e.x > 0) {
fireEnemyBullet(e);
e.shootCooldown = e instanceof Tank ? 30 : 60;
}
}
// Collide with player
if (e.intersects(rhea)) {
rhea.hp -= 2;
showExplosion(e.x, e.y);
e.destroy();
enemies.splice(i, 1);
if (rhea.hp <= 0) {
gameOver = true;
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
return;
}
updateUI();
}
}
// Update powerups
for (var i = powerups.length - 1; i >= 0; i--) {
var p = powerups[i];
p.update();
if (p.x < -60) {
p.destroy();
powerups.splice(i, 1);
continue;
}
// Pickup by player
if (p.intersects(rhea)) {
if (p instanceof PowerupHealth) {
rhea.hp = Math.min(rhea.hp + 2, 7);
} else if (p instanceof PowerupAmmo) {
// For MVP, just increase resources
resources += 2;
}
LK.getSound('pickup').play();
p.destroy();
powerups.splice(i, 1);
updateUI();
}
}
// Win condition: score threshold
if (score >= 50) {
youWin = true;
LK.effects.flashScreen(0x00ff00, 1000);
LK.showYouWin();
return;
}
};
// Initial UI update
updateUI(); ===================================================================
--- original.js
+++ change.js
@@ -151,10 +151,10 @@
/****
* Game Code
****/
-// Forest war background image
-var battlefieldBg = LK.getAsset('forest_war_bg', {
+// World War I background image
+var battlefieldBg = LK.getAsset('ww1_bg', {
anchorX: 0,
anchorY: 0,
x: 0,
y: 0,
soldier character. In-Game asset. 2d. High contrast. No shadows
Enemy robot. In-Game asset. 2d. High contrast. No shadows
Let the tank face left. In-Game asset. 2d. High contrast. No shadows
Sniper soldier. In-Game asset. 2d. High contrast. No shadows
Medic Soldier. In-Game asset. 2d. High contrast. No shadows
Health. In-Game asset. 2d. High contrast. No shadows
Ammo. In-Game asset. 2d. High contrast. No shadows
bullet enemy. In-Game asset. 2d. High contrast. No shadows
smile bullet to the right. In-Game asset. 2d. High contrast. No shadows
explosion effect. In-Game asset. 2d. High contrast. No shadows
dron enemy. In-Game asset. 2d. High contrast. No shadows
technological soldier. In-Game asset. 2d. High contrast. No shadows
just laser. In-Game asset. 2d. High contrast. No shadows
technological enemy. In-Game asset. 2d. High contrast. No shadows