/****
* Classes
****/
//<Assets used in the game will automatically appear here>
// Class for the Electric bat
var ElectricBat = Container.expand(function () {
var self = Container.call(this);
var heroIdleGraphics = self.attachAsset('electricBatIdle', {
anchorX: 0.5,
anchorY: 0.5
});
var heroHitGraphics = self.attachAsset('electricBatHit', {
anchorX: 0.5,
anchorY: 0.5
});
heroHitGraphics.visible = false; // Hide the hit sprite initially
heroHitGraphics.visible = false; // Hide the hit sprite initially
self.speed = 10;
self.update = function () {
// Electric bat update logic
};
self.down = function (x, y, obj) {
heroIdleGraphics.visible = false;
heroHitGraphics.visible = true;
};
self.up = function (x, y, obj) {
heroIdleGraphics.visible = true;
heroHitGraphics.visible = false;
};
});
// Class for the Killed Mosquito
var KilledMosquito = Container.expand(function () {
var self = Container.call(this);
var killedMosquitoGraphics = self.attachAsset('killedMosquito', {
anchorX: 0.5,
anchorY: 0.5
});
self.update = function () {
// Killed mosquito update logic
};
});
// Class for the Mosquito
var Mosquito = Container.expand(function () {
var self = Container.call(this);
var mosquitoGraphics = self.attachAsset('mosquito', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
self.y += self.speed;
if (self.y > 2732 - crowd.height) {
self.destroy();
}
};
self.down = function (x, y, obj) {
self.destroy();
score++;
scoreTxt.setText(score);
// Spawn a killed mosquito sprite at the location of the killed mosquito
var killedMosquito = new KilledMosquito();
killedMosquito.x = self.x;
killedMosquito.y = self.y;
game.addChild(killedMosquito);
// Set a timer to remove the killed mosquito sprite after 2 seconds with a fade effect
LK.setTimeout(function () {
var fadeOutInterval = LK.setInterval(function () {
killedMosquito.alpha -= 0.05;
if (killedMosquito.alpha <= 0) {
LK.clearInterval(fadeOutInterval);
killedMosquito.destroy();
}
}, 100);
}, 2000);
// Play a sound
LK.getSound('mosquitoHit').play();
if (score % 50 == 0) {
wave++;
spawnSpeed = Math.max(30, spawnSpeed - 10);
LK.effects.flashScreen(0x00ff00, 1000);
var waveTxt = new Text2('Wave ' + wave, {
size: 150,
fill: "#ffffff"
});
waveTxt.anchor.set(0.5, 0.5);
waveTxt.x = 2048 / 2;
waveTxt.y = 2732 / 2;
LK.gui.center.addChild(waveTxt);
LK.setTimeout(function () {
waveTxt.destroy();
}, 2000);
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
var crowd = game.addChild(LK.getAsset('crowd', {
anchorX: 0.5,
anchorY: 1,
x: 2048 / 2,
y: 2732
}));
var electricBat = game.addChild(new ElectricBat());
electricBat.x = 2048 / 2;
electricBat.y = 2732 - 200;
var enemies = [];
var score = 0;
var wave = 1;
var spawnSpeed = 60;
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
scoreTxt.anchor.set(0.5, 0);
LK.gui.top.addChild(scoreTxt);
var gameTitle = new Text2('SAVE THE EARTH FROM ROBOTIC MOSQUITOS', {
size: 60,
fill: "#ffffff"
});
gameTitle.anchor.set(0.5, 0);
gameTitle.y = 150;
LK.gui.top.addChild(gameTitle);
function spawnEnemy() {
var mosquito = new Mosquito();
mosquito.x = 100 + Math.random() * (2048 - mosquito.width - 200);
mosquito.y = -mosquito.height;
enemies.push(mosquito);
game.addChild(mosquito);
}
game.down = function (x, y, obj) {
electricBat.x = x;
electricBat.y = y;
electricBat.down(x, y, obj);
// Play a different sound
LK.getSound('screenClick').play();
};
game.move = function (x, y, obj) {
electricBat.x = x;
electricBat.y = y;
electricBat.up(x, y, obj);
};
game.update = function () {
for (var i = enemies.length - 1; i >= 0; i--) {
enemies[i].update();
if (crowd.intersects(enemies[i])) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
}
if (LK.ticks % spawnSpeed == 0) {
spawnEnemy();
}
};
The robotic mosquito is a marvel of miniature engineering, its metallic body gleaming in the light. Its two transparent wings, adorned with intricate circuitry patterns, buzz rhythmically as it hovers and darts through the air. Six delicate legs, tipped with sharp points, enable it to perch on surfaces with remarkable precision. A pair of long, segmented antennae, their tips glowing faintly, twitch and sense the environment. Two glowing eyes, either red or blue, emit an eerie light as they scan the surroundings. However, this mechanical menace can also be crushed, its once pristine form reduced to a mangled mess of dented metal, broken wings, and exposed wires. Sparks might fly from its damaged innards, and its once bright eyes may flicker and fade. This sprite sheet captures both the living and destroyed states of the robotic mosquito, showcasing its intricate details and the grim aftermath of its demise.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
The electric mosquito killing bat sprite sheet will illustrate the device in two states: idle and activated. In the idle state, the bat resembles a tennis racket with a fine mesh grid, featuring a handle for easy grip and a subtle glow emanating from the electrified grid. The activated state showcases the bat in action, zapping mosquitoes with bright sparks and flashes of electricity as they come into contact with the mesh. The sparks should be animated to convey the sensation of a powerful electric discharge. Additional details could include small mosquito silhouettes near the grid in the activated state, or a faint buzzing sound effect to enhance the visual and auditory experience.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.