/**** * Classes ****/ var Boss = Container.expand(function () { var self = Container.call(this); var bossGraphics = self.attachAsset('boss', { anchorX: 0.5, anchorY: 0.5, scaleX: 2, scaleY: 2 }); self.health = 100; self.speed = 8; self.update = function () { // Sinusoidal movement for the boss self.x += self.speed * Math.sin(LK.ticks / 50); self.y += self.speed * Math.cos(LK.ticks / 50); // Ensure the boss stays within the game boundaries if (self.x < 0) { self.x = 0; } if (self.x > 2048 - self.width) { self.x = 2048 - self.width; } if (self.y < 0) { self.y = 0; } if (self.y > 2732 - self.height) { self.y = 2732 - self.height; } // Shooting mechanism for the boss if (self.shootTimer <= 0) { self.parent.createBossBullet(self); self.shootTimer = 120; } else { self.shootTimer--; } }; }); var BossBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.attachAsset('bossBullet', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 15; self._move_migrated = function () { self.y += self.speed; }; }); var BossLaser = Container.expand(function () { var self = Container.call(this); var laserGraphics = self.attachAsset('bossLaser', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 10; self._move_migrated = function () { self.y += self.speed; }; }); var BossOne = Container.expand(function () { var self = Container.call(this); var bossOneGraphics = self.attachAsset('bossOne', { anchorX: 0.5, anchorY: 0.5 }); self.health = 100; self.speed = 8; }); var BossRockets = Container.expand(function () { var self = Container.call(this); var rocketsGraphics = self.attachAsset('bossRockets', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 15; self._move_migrated = function () { self.y += self.speed; }; }); var BossThree = Container.expand(function () { var self = Container.call(this); var bossThreeGraphics = self.attachAsset('bossThree', { anchorX: 0.5, anchorY: 0.5 }); self.health = 200; self.speed = 12; }); var BossTwo = Container.expand(function () { var self = Container.call(this); var bossTwoGraphics = self.attachAsset('bossTwo', { anchorX: 0.5, anchorY: 0.5 }); self.health = 150; self.speed = 10; }); 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._move_migrated = function () { self.y -= self.speed; }; }); var NinjaHero = Container.expand(function () { var self = Container.call(this); var ninjaGraphics = self.attachAsset('ninjaHero', { anchorX: 0.5, anchorY: 0.5 }); self.on('down', function () { self.throwLaser(); }); self.speed = 5; self._move_migrated = function (direction) { if (direction === 'left' && self.x > 0) { self.x -= self.speed; } else if (direction === 'right' && self.x < 2048 - self.width) { self.x += self.speed; } else if (direction === 'up' && self.y > 0) { self.y -= self.speed; } else if (direction === 'down' && self.y < 2732 - self.height) { self.y += self.speed; } }; self.throwLaser = function () { var laser = new NinjaLaser(); laser.x = self.x; laser.y = self.y - self.height / 2; self.parent.ninjaLasers.push(laser); self.parent.addChild(laser); LK.setScore(LK.getScore() + 10); }; }); var NinjaLaser = Container.expand(function () { var self = Container.call(this); var laserGraphics = self.attachAsset('bossLaser', { anchorX: 0.5, anchorY: 0.5 }); self.speed = 20; self._move_migrated = function () { self.y -= self.speed; }; }); /**** * Initialize Game ****/ var game = new LK.Game({ backgroundColor: 0x000000 }); /**** * Game Code ****/ game.createBossRocket = function (boss) { var rocket = new BossRockets(); rocket.x = boss.x; rocket.y = boss.y + boss.height / 2; game.bossRockets.push(rocket); game.addChild(rocket); }; game.manageBossHealth = function (boss, amount) { boss.health -= amount; if (boss.health <= 0) { LK.showGameOver(); boss.destroy(); game.advanceLevel(); } }; game.createBossLaser = function (boss) { var laser = new BossLaser(); laser.x = boss.x; laser.y = boss.y + boss.height / 2; game.bossLasers.push(laser); game.addChild(laser); }; game.currentLevel = 1; game.maxLevel = 5; game.levelDifficulty = [1, 2, 3, 4, 5]; game.levelBossHealth = [100, 150, 200, 250, 300]; var cityBackground = game.attachAsset('cityBackground', {}); cityBackground.width = 2048; cityBackground.height = 2732; game.addChildAt(cityBackground, 0); var ninjaHero = game.addChild(new NinjaHero()); ninjaHero.x = 2048 / 2; ninjaHero.y = 2732 - ninjaHero.height; game.ninjaLasers = []; game.bossLasers = []; game.bossBullets = []; game.heroBullets = []; var boss = game.addChild(new Boss()); boss.x = 2048 / 2; boss.y = 100; boss.health = game.levelBossHealth[game.currentLevel - 1]; game.on('down', function (x, y, obj) { var event = obj; var pos = game.toLocal(event.global); ninjaHero.x = pos.x; ninjaHero.y = pos.y; }); game.advanceLevel = function () { if (game.currentLevel < game.maxLevel) { game.currentLevel++; boss.health = game.levelBossHealth[game.currentLevel - 1]; } else { LK.showWin(); } }; LK.on('tick', function () { for (var i = game.ninjaLasers.length - 1; i >= 0; i--) { game.ninjaLasers[i]._move_migrated(); if (game.ninjaLasers[i].y < -50) { game.ninjaLasers[i].destroy(); game.ninjaLasers.splice(i, 1); } else if (game.ninjaLasers[i].intersects(boss)) { game.manageBossHealth(boss, 100); game.ninjaLasers[i].destroy(); game.ninjaLasers.splice(i, 1); } } for (var i = game.bossLasers.length - 1; i >= 0; i--) { game.bossLasers[i]._move_migrated(); if (game.bossLasers[i].y > 2732) { game.bossLasers[i].destroy(); game.bossLasers.splice(i, 1); } else if (game.bossLasers[i].intersects(ninjaHero)) { LK.showGameOver(); game.bossLasers[i].destroy(); game.bossLasers.splice(i, 1); } } }); game.createBossBullet = function (boss) { var bullet = new BossBullet(); bullet.x = boss.x; bullet.y = boss.y + boss.height / 2; game.bossBullets.push(bullet); game.addChild(bullet); };
/****
* Classes
****/
var Boss = Container.expand(function () {
var self = Container.call(this);
var bossGraphics = self.attachAsset('boss', {
anchorX: 0.5,
anchorY: 0.5,
scaleX: 2,
scaleY: 2
});
self.health = 100;
self.speed = 8;
self.update = function () {
// Sinusoidal movement for the boss
self.x += self.speed * Math.sin(LK.ticks / 50);
self.y += self.speed * Math.cos(LK.ticks / 50);
// Ensure the boss stays within the game boundaries
if (self.x < 0) {
self.x = 0;
}
if (self.x > 2048 - self.width) {
self.x = 2048 - self.width;
}
if (self.y < 0) {
self.y = 0;
}
if (self.y > 2732 - self.height) {
self.y = 2732 - self.height;
}
// Shooting mechanism for the boss
if (self.shootTimer <= 0) {
self.parent.createBossBullet(self);
self.shootTimer = 120;
} else {
self.shootTimer--;
}
};
});
var BossBullet = Container.expand(function () {
var self = Container.call(this);
var bulletGraphics = self.attachAsset('bossBullet', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self._move_migrated = function () {
self.y += self.speed;
};
});
var BossLaser = Container.expand(function () {
var self = Container.call(this);
var laserGraphics = self.attachAsset('bossLaser', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 10;
self._move_migrated = function () {
self.y += self.speed;
};
});
var BossOne = Container.expand(function () {
var self = Container.call(this);
var bossOneGraphics = self.attachAsset('bossOne', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 100;
self.speed = 8;
});
var BossRockets = Container.expand(function () {
var self = Container.call(this);
var rocketsGraphics = self.attachAsset('bossRockets', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 15;
self._move_migrated = function () {
self.y += self.speed;
};
});
var BossThree = Container.expand(function () {
var self = Container.call(this);
var bossThreeGraphics = self.attachAsset('bossThree', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 200;
self.speed = 12;
});
var BossTwo = Container.expand(function () {
var self = Container.call(this);
var bossTwoGraphics = self.attachAsset('bossTwo', {
anchorX: 0.5,
anchorY: 0.5
});
self.health = 150;
self.speed = 10;
});
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._move_migrated = function () {
self.y -= self.speed;
};
});
var NinjaHero = Container.expand(function () {
var self = Container.call(this);
var ninjaGraphics = self.attachAsset('ninjaHero', {
anchorX: 0.5,
anchorY: 0.5
});
self.on('down', function () {
self.throwLaser();
});
self.speed = 5;
self._move_migrated = function (direction) {
if (direction === 'left' && self.x > 0) {
self.x -= self.speed;
} else if (direction === 'right' && self.x < 2048 - self.width) {
self.x += self.speed;
} else if (direction === 'up' && self.y > 0) {
self.y -= self.speed;
} else if (direction === 'down' && self.y < 2732 - self.height) {
self.y += self.speed;
}
};
self.throwLaser = function () {
var laser = new NinjaLaser();
laser.x = self.x;
laser.y = self.y - self.height / 2;
self.parent.ninjaLasers.push(laser);
self.parent.addChild(laser);
LK.setScore(LK.getScore() + 10);
};
});
var NinjaLaser = Container.expand(function () {
var self = Container.call(this);
var laserGraphics = self.attachAsset('bossLaser', {
anchorX: 0.5,
anchorY: 0.5
});
self.speed = 20;
self._move_migrated = function () {
self.y -= self.speed;
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000
});
/****
* Game Code
****/
game.createBossRocket = function (boss) {
var rocket = new BossRockets();
rocket.x = boss.x;
rocket.y = boss.y + boss.height / 2;
game.bossRockets.push(rocket);
game.addChild(rocket);
};
game.manageBossHealth = function (boss, amount) {
boss.health -= amount;
if (boss.health <= 0) {
LK.showGameOver();
boss.destroy();
game.advanceLevel();
}
};
game.createBossLaser = function (boss) {
var laser = new BossLaser();
laser.x = boss.x;
laser.y = boss.y + boss.height / 2;
game.bossLasers.push(laser);
game.addChild(laser);
};
game.currentLevel = 1;
game.maxLevel = 5;
game.levelDifficulty = [1, 2, 3, 4, 5];
game.levelBossHealth = [100, 150, 200, 250, 300];
var cityBackground = game.attachAsset('cityBackground', {});
cityBackground.width = 2048;
cityBackground.height = 2732;
game.addChildAt(cityBackground, 0);
var ninjaHero = game.addChild(new NinjaHero());
ninjaHero.x = 2048 / 2;
ninjaHero.y = 2732 - ninjaHero.height;
game.ninjaLasers = [];
game.bossLasers = [];
game.bossBullets = [];
game.heroBullets = [];
var boss = game.addChild(new Boss());
boss.x = 2048 / 2;
boss.y = 100;
boss.health = game.levelBossHealth[game.currentLevel - 1];
game.on('down', function (x, y, obj) {
var event = obj;
var pos = game.toLocal(event.global);
ninjaHero.x = pos.x;
ninjaHero.y = pos.y;
});
game.advanceLevel = function () {
if (game.currentLevel < game.maxLevel) {
game.currentLevel++;
boss.health = game.levelBossHealth[game.currentLevel - 1];
} else {
LK.showWin();
}
};
LK.on('tick', function () {
for (var i = game.ninjaLasers.length - 1; i >= 0; i--) {
game.ninjaLasers[i]._move_migrated();
if (game.ninjaLasers[i].y < -50) {
game.ninjaLasers[i].destroy();
game.ninjaLasers.splice(i, 1);
} else if (game.ninjaLasers[i].intersects(boss)) {
game.manageBossHealth(boss, 100);
game.ninjaLasers[i].destroy();
game.ninjaLasers.splice(i, 1);
}
}
for (var i = game.bossLasers.length - 1; i >= 0; i--) {
game.bossLasers[i]._move_migrated();
if (game.bossLasers[i].y > 2732) {
game.bossLasers[i].destroy();
game.bossLasers.splice(i, 1);
} else if (game.bossLasers[i].intersects(ninjaHero)) {
LK.showGameOver();
game.bossLasers[i].destroy();
game.bossLasers.splice(i, 1);
}
}
});
game.createBossBullet = function (boss) {
var bullet = new BossBullet();
bullet.x = boss.x;
bullet.y = boss.y + boss.height / 2;
game.bossBullets.push(bullet);
game.addChild(bullet);
};
HERO IS A MASTER SAMURAI WARRIOR Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.RTX ON.INRECEDIBLE DETAIL.ULTRA HD .
future japan high graphics photo
a samurai sumo big in size. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a samurai sumo big in size. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.