User prompt
Add many stone on other place
User prompt
Hero's plane are not moving
User prompt
Please fix the bug: 'ReferenceError: dragNode is not defined' in or related to this line: 'if (dragNode) {' Line Number: 157
User prompt
And produce the big stone on the background for the protection
User prompt
Black colour and stars on background
User prompt
And plz change background
User prompt
Also add movement on enemy plane and he attacked on hero plane with bullet
User prompt
I want to move my plain
Initial prompt
A war
/****
* Classes
****/
// Enemy class
var Enemy = Container.expand(function () {
var self = Container.call(this);
var enemyGraphics = self.attachAsset('enemy', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 5;
self.update = function () {
self.y += self.speed;
if (self.y > 2732) {
self.destroy();
}
};
});
// EnemyBullet class
var EnemyBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('enemyBullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 10;
self.update = function () {
self.y += self.speed;
if (self.y > 2732) {
self.destroy();
}
};
});
// Hero class
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = self.attachAsset('hero', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 10;
self.shoot = function () {
var bullet = new HeroBullet();
bullet.x = self.x;
bullet.y = self.y - 50;
game.addChild(bullet);
heroBullets.push(bullet);
};
});
// HeroBullet class
var HeroBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('heroBullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = -15;
self.update = function () {
self.y += self.speed;
if (self.y < 0) {
self.destroy();
}
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x87CEEB // Sky blue background
});
/****
* Game Code
****/
// Assets will be automatically created and loaded by the LK engine based on their usage in the code.
// Initialize assets used in this game.
var hero = new Hero();
hero.x = 2048 / 2;
hero.y = 2732 - 150;
game.addChild(hero);
var enemies = [];
var heroBullets = [];
var enemyBullets = [];
game.down = function (x, y, obj) {
hero.shoot();
};
game.update = function () {
// Update hero bullets
for (var i = heroBullets.length - 1; i >= 0; i--) {
heroBullets[i].update();
for (var j = enemies.length - 1; j >= 0; j--) {
if (heroBullets[i].intersects(enemies[j])) {
enemies[j].destroy();
heroBullets[i].destroy();
enemies.splice(j, 1);
heroBullets.splice(i, 1);
break;
}
}
}
// Update enemies
for (var i = enemies.length - 1; i >= 0; i--) {
enemies[i].update();
if (enemies[i].intersects(hero)) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
}
// Spawn enemies
if (LK.ticks % 60 == 0) {
var enemy = new Enemy();
enemy.x = Math.random() * 2048;
enemy.y = -50;
game.addChild(enemy);
enemies.push(enemy);
}
};
Fighter plane. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Sharpe bullet of plane. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Little stars. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Mountain rock. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Dangerous fight plane. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.