/**** 
* Classes
****/ 
//<Assets used in the game will automatically appear here>
// Bullet class
var Bullet = Container.expand(function () {
	var self = Container.call(this);
	var bulletGraphics = self.attachAsset('bullet', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = -10;
	self.update = function () {
		self.y += self.speed;
	};
});
// Hero class
var Hero = Container.expand(function () {
	var self = Container.call(this);
	var heroGraphics = self.attachAsset('hero', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.shoot = function () {
		var newBullet = new Bullet();
		newBullet.x = self.x;
		newBullet.y = self.y;
		bullets.push(newBullet);
		game.addChild(newBullet);
	};
});
// Monster class
var Monster = Container.expand(function () {
	var self = Container.call(this);
	var monsterGraphics = self.attachAsset('monster', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 2;
	self.update = function () {
		var dx = hero.x - self.x;
		var dy = hero.y - self.y;
		var dist = Math.sqrt(dx * dx + dy * dy);
		self.x += dx / dist * self.speed;
		self.y += dy / dist * self.speed;
	};
});
// Particle class
var Particle = Container.expand(function () {
	var self = Container.call(this);
	var particleGraphics = self.attachAsset('particle', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speedX = Math.random() * 10 - 5;
	self.speedY = Math.random() * 10 - 5;
	self.update = function () {
		self.x += self.speedX;
		self.y += self.speedY;
		self.speedX *= 0.99;
		self.speedY *= 0.99;
		self.alpha *= 0.96;
		if (self.alpha < 0.01) {
			self.destroy();
		}
	};
});
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x000000
});
/**** 
* Game Code
****/ 
var background = game.addChild(LK.getAsset('background', {
	anchorX: 0.5,
	anchorY: 0.5
}));
background.x = 2048 / 2;
background.y = 2732 / 2;
// Initialize variables
var hero = new Hero();
hero.x = 2048 / 2;
hero.y = 2732 - 200;
game.addChild(hero);
var bullets = [];
var monsters = [];
var score = 0;
var scoreTxt = new Text2('0', {
	size: 150,
	fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Spawn monsters at intervals
var spawnMonster = LK.setInterval(function () {
	var newMonster = new Monster();
	newMonster.x = Math.random() * 2048;
	newMonster.y = 0;
	monsters.push(newMonster);
	game.addChild(newMonster);
}, 2000);
// Handle game updates
game.update = function () {
	for (var i = bullets.length - 1; i >= 0; i--) {
		bullets[i].update();
		if (bullets[i].y < -50) {
			bullets[i].destroy();
			bullets.splice(i, 1);
		}
	}
	for (var j = monsters.length - 1; j >= 0; j--) {
		monsters[j].update();
		if (monsters[j].intersects(hero)) {
			LK.effects.flashScreen(0xff0000, 1000);
			LK.showGameOver();
		}
		for (var k = bullets.length - 1; k >= 0; k--) {
			if (monsters[j] && monsters[j].intersects(bullets[k])) {
				// Create particles when the monster is destroyed
				for (var p = 0; p < 100; p++) {
					var newParticle = new Particle();
					newParticle.x = monsters[j].x;
					newParticle.y = monsters[j].y;
					game.addChild(newParticle);
				}
				monsters[j].destroy();
				monsters.splice(j, 1);
				score++;
				scoreTxt.setText(score);
				LK.effects.flashObject(scoreTxt, 0x00ff00, 1000);
				if (score == 200) {
					LK.showGameOver();
				}
			}
		}
	}
};
// Handle touch events
game.down = function (x, y, obj) {
	hero.shoot();
};
game.move = function (x, y, obj) {
	hero.x = x;
	hero.y = y;
};
game.up = function (x, y, obj) {
	// No action needed on touch up
};
// Update particles
for (var i = game.children.length - 1; i >= 0; i--) {
	if (game.children[i] instanceof Particle) {
		game.children[i].update();
	}
} /**** 
* Classes
****/ 
//<Assets used in the game will automatically appear here>
// Bullet class
var Bullet = Container.expand(function () {
	var self = Container.call(this);
	var bulletGraphics = self.attachAsset('bullet', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = -10;
	self.update = function () {
		self.y += self.speed;
	};
});
// Hero class
var Hero = Container.expand(function () {
	var self = Container.call(this);
	var heroGraphics = self.attachAsset('hero', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.shoot = function () {
		var newBullet = new Bullet();
		newBullet.x = self.x;
		newBullet.y = self.y;
		bullets.push(newBullet);
		game.addChild(newBullet);
	};
});
// Monster class
var Monster = Container.expand(function () {
	var self = Container.call(this);
	var monsterGraphics = self.attachAsset('monster', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speed = 2;
	self.update = function () {
		var dx = hero.x - self.x;
		var dy = hero.y - self.y;
		var dist = Math.sqrt(dx * dx + dy * dy);
		self.x += dx / dist * self.speed;
		self.y += dy / dist * self.speed;
	};
});
// Particle class
var Particle = Container.expand(function () {
	var self = Container.call(this);
	var particleGraphics = self.attachAsset('particle', {
		anchorX: 0.5,
		anchorY: 0.5
	});
	self.speedX = Math.random() * 10 - 5;
	self.speedY = Math.random() * 10 - 5;
	self.update = function () {
		self.x += self.speedX;
		self.y += self.speedY;
		self.speedX *= 0.99;
		self.speedY *= 0.99;
		self.alpha *= 0.96;
		if (self.alpha < 0.01) {
			self.destroy();
		}
	};
});
/**** 
* Initialize Game
****/ 
var game = new LK.Game({
	backgroundColor: 0x000000
});
/**** 
* Game Code
****/ 
var background = game.addChild(LK.getAsset('background', {
	anchorX: 0.5,
	anchorY: 0.5
}));
background.x = 2048 / 2;
background.y = 2732 / 2;
// Initialize variables
var hero = new Hero();
hero.x = 2048 / 2;
hero.y = 2732 - 200;
game.addChild(hero);
var bullets = [];
var monsters = [];
var score = 0;
var scoreTxt = new Text2('0', {
	size: 150,
	fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
// Spawn monsters at intervals
var spawnMonster = LK.setInterval(function () {
	var newMonster = new Monster();
	newMonster.x = Math.random() * 2048;
	newMonster.y = 0;
	monsters.push(newMonster);
	game.addChild(newMonster);
}, 2000);
// Handle game updates
game.update = function () {
	for (var i = bullets.length - 1; i >= 0; i--) {
		bullets[i].update();
		if (bullets[i].y < -50) {
			bullets[i].destroy();
			bullets.splice(i, 1);
		}
	}
	for (var j = monsters.length - 1; j >= 0; j--) {
		monsters[j].update();
		if (monsters[j].intersects(hero)) {
			LK.effects.flashScreen(0xff0000, 1000);
			LK.showGameOver();
		}
		for (var k = bullets.length - 1; k >= 0; k--) {
			if (monsters[j] && monsters[j].intersects(bullets[k])) {
				// Create particles when the monster is destroyed
				for (var p = 0; p < 100; p++) {
					var newParticle = new Particle();
					newParticle.x = monsters[j].x;
					newParticle.y = monsters[j].y;
					game.addChild(newParticle);
				}
				monsters[j].destroy();
				monsters.splice(j, 1);
				score++;
				scoreTxt.setText(score);
				LK.effects.flashObject(scoreTxt, 0x00ff00, 1000);
				if (score == 200) {
					LK.showGameOver();
				}
			}
		}
	}
};
// Handle touch events
game.down = function (x, y, obj) {
	hero.shoot();
};
game.move = function (x, y, obj) {
	hero.x = x;
	hero.y = y;
};
game.up = function (x, y, obj) {
	// No action needed on touch up
};
// Update particles
for (var i = game.children.length - 1; i >= 0; i--) {
	if (game.children[i] instanceof Particle) {
		game.children[i].update();
	}
}
 uma bola preta com chifres, e com olhos vermelhos com um sorriso assustador, fundo png. Single Game Texture. In-Game asset. 3d. Blank background. High contrast. No shadows.
 uma bola verde, com olhos azuiis fofos , fundo png. Single Game Texture. In-Game asset. 3d. Blank background. High contrast. No shadows.
 uma particula vermelha brilhante, fundo png. Single Game Texture. In-Game asset. 3d. Blank background. High contrast. No shadows.
 pariculas cinzas, fundo png. Single Game Texture. In-Game asset. 3d. Blank background. High contrast. No shadows.
 uma rua com ceu azul, fundo png. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.