var HeroBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.createAsset('heroBullet', 'Hero Bullet Graphics', .5, .5);
self.speed = -5;
self.move = function () {
self.x += self.speed;
};
});
var EnemyBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.createAsset('enemyBullet', 'Enemy Bullet Graphics', .5, .5);
self.speed = 5;
self.move = function () {
self.x += self.speed;
};
});
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = self.createAsset('hero', 'Hero character', .5, .5);
self.knockback = function () {
self.x -= 10;
};
});
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.createAsset('enemy', 'Enemy character', .5, .5);
});
var Game = Container.expand(function () {
var self = Container.call(this);
LK.stageContainer.setBackgroundColor(0x000000);
var hero = self.addChild(new Hero());
var enemy = self.addChild(new Enemy());
hero.x = 1024;
hero.y = 1366;
enemy.x = 1024;
enemy.y = 1366 - 200;
var heroBullets = [];
var enemyBullets = [];
var isGameOver = false;
var tickOffset = 0;
LK.on('tick', function () {
if (isGameOver) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
for (var a = heroBullets.length; a >= 0; a--) {
heroBullets[a].move();
if (heroBullets[a].y < -50) {
heroBullets[a].destroy();
heroBullets.splice(a, 1);
}
}
for (var a = enemyBullets.length; a >= 0; a--) {
enemyBullets[a].move();
if (enemyBullets[a].y > 2732 + 50) {
enemyBullets[a].destroy();
enemyBullets.splice(a, 1);
}
}
if (tickOffset++ % 30 == 0) {
var newBullet = new HeroBullet();
newBullet.x = hero.x;
newBullet.y = hero.y;
heroBullets.push(newBullet);
self.addChild(newBullet);
hero.knockback();
}
});
});
watergun Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
water ball Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
water health bar Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
fire Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
blue play button Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
explosion smoke Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.