User prompt
make the boss asset move
User prompt
please make the boss asset bigger in size and shooting bullets
User prompt
Migrate to the latest version of LK
User prompt
make 3 boss assets and add them to the game
User prompt
make boss shoot rockets
User prompt
add a new asset called boss rockets
User prompt
health magement should be managed by game class
User prompt
make the game class handle the creation of lasers
User prompt
change the boss movement and fix the boss movement error
User prompt
Fix Bug: 'TypeError: LK.showWin is not a function' in this line: 'LK.showWin();' Line Number: 52
User prompt
Fix Bug: 'TypeError: LK.showVictory is not a function' in this line: 'LK.showVictory();' Line Number: 52
User prompt
Fix Bug: 'TypeError: LK.showWin is not a function' in this line: 'LK.showWin();' Line Number: 52
User prompt
Fix Bug: 'TypeError: LK.showWinScreen is not a function' in this line: 'LK.showWinScreen();' Line Number: 52
User prompt
Fix Bug: 'TypeError: LK.showWin is not a function' in this line: 'LK.showWin();' Line Number: 52
User prompt
make the boss fight the ninja hero and if the boss gets hit the player wins the game and if the player gets hit by the boss he loses and game over
User prompt
use the boss laser asset on the boss asset to launch rockets on the ninja hero and make the boss move rapidly while shooting boss laser
User prompt
change ninja laser asset to boss laser asset
User prompt
include levels to win
User prompt
let the boss shoot rocket bullets and move in rapid motion
User prompt
if the boss gets hit by ninja hero the player wins
User prompt
let the boss move in rapid direction shooting lasers
User prompt
let the ninja hero shoot lasers
User prompt
let the ninja hero have a highscore
User prompt
add a city asset background in future japan
User prompt
let the hero shoot ninja laser
/**** * Classes ****/ var Boss = Container.expand(function () { var self = Container.call(this); var bossGraphics = self.attachAsset('boss', { anchorX: 0.5, anchorY: 0.5 }); self.health = 100; self.speed = 8; self._move_migrated = function () { if (!self.direction || self.x <= 0) { self.direction = 'right'; } else if (self.x >= 2048 - self.width) { self.direction = 'left'; } if (self.direction === 'left') { self.x -= self.speed; } else if (self.direction === 'right') { self.x += self.speed; } if (self.shootTimer <= 0) { self.parent.createBossRocket(self); self.shootTimer = 120; } else { self.shootTimer--; } }; }); 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.bossRockets = []; 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); } } });
===================================================================
--- original.js
+++ change.js
@@ -1,79 +1,114 @@
-var BossThree = Container.expand(function () {
+/****
+* Classes
+****/
+var Boss = Container.expand(function () {
var self = Container.call(this);
- var bossThreeGraphics = self.createAsset('bossThree', 'Third Boss', .5, .5);
- self.health = 200;
- self.speed = 12;
+ var bossGraphics = self.attachAsset('boss', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.health = 100;
+ self.speed = 8;
+ self._move_migrated = function () {
+ if (!self.direction || self.x <= 0) {
+ self.direction = 'right';
+ } else if (self.x >= 2048 - self.width) {
+ self.direction = 'left';
+ }
+ if (self.direction === 'left') {
+ self.x -= self.speed;
+ } else if (self.direction === 'right') {
+ self.x += self.speed;
+ }
+ if (self.shootTimer <= 0) {
+ self.parent.createBossRocket(self);
+ self.shootTimer = 120;
+ } else {
+ self.shootTimer--;
+ }
+ };
});
-var BossTwo = Container.expand(function () {
+var BossLaser = Container.expand(function () {
var self = Container.call(this);
- var bossTwoGraphics = self.createAsset('bossTwo', 'Second Boss', .5, .5);
- self.health = 150;
+ 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.createAsset('bossOne', 'First Boss', .5, .5);
+ 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.createAsset('bossRockets', 'Boss Rockets', .5, .5);
+ var rocketsGraphics = self.attachAsset('bossRockets', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
self.speed = 15;
- self.move = function () {
+ self._move_migrated = function () {
self.y += self.speed;
};
});
-var BossLaser = Container.expand(function () {
+var BossThree = Container.expand(function () {
var self = Container.call(this);
- var laserGraphics = self.createAsset('bossLaser', 'Boss Laser', .5, .5);
+ 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;
- self.move = function () {
- self.y += self.speed;
- };
});
-var NinjaLaser = Container.expand(function () {
+var HeroBullet = Container.expand(function () {
var self = Container.call(this);
- var laserGraphics = self.createAsset('bossLaser', 'Boss Laser', .5, .5);
- self.speed = 20;
- self.move = function () {
+ var bulletGraphics = self.attachAsset('heroBullet', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 15;
+ self._move_migrated = function () {
self.y -= self.speed;
};
});
-var Boss = Container.expand(function () {
- var self = Container.call(this);
- var bossGraphics = self.createAsset('boss', 'Evil Boss', .5, .5);
- self.health = 100;
- self.speed = 8;
- self.move = function () {
- if (!self.direction || self.x <= 0) {
- self.direction = 'right';
- } else if (self.x >= 2048 - self.width) {
- self.direction = 'left';
- }
- if (self.direction === 'left') {
- self.x -= self.speed;
- } else if (self.direction === 'right') {
- self.x += self.speed;
- }
- if (self.shootTimer <= 0) {
- self.parent.createBossRocket(self);
- self.shootTimer = 120;
- } else {
- self.shootTimer--;
- }
- };
-});
var NinjaHero = Container.expand(function () {
var self = Container.call(this);
- var ninjaGraphics = self.createAsset('ninjaHero', 'Ninja Hero', .5, .5);
+ var ninjaGraphics = self.attachAsset('ninjaHero', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
self.on('down', function () {
self.throwLaser();
});
self.speed = 5;
- self.move = 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._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;
@@ -82,94 +117,105 @@
self.parent.addChild(laser);
LK.setScore(LK.getScore() + 10);
};
});
-var HeroBullet = Container.expand(function () {
+var NinjaLaser = Container.expand(function () {
var self = Container.call(this);
- var bulletGraphics = self.createAsset('heroBullet', 'Hero Bullet', .5, .5);
- self.speed = 15;
- self.move = function () {
+ var laserGraphics = self.attachAsset('bossLaser', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 20;
+ self._move_migrated = function () {
self.y -= self.speed;
};
});
-var Game = Container.expand(function () {
- var self = Container.call(this);
- self.createBossRocket = function (boss) {
- var rocket = new BossRockets();
- rocket.x = boss.x;
- rocket.y = boss.y + boss.height / 2;
- self.bossRockets.push(rocket);
- self.addChild(rocket);
- };
- self.manageBossHealth = function (boss, amount) {
- boss.health -= amount;
- if (boss.health <= 0) {
+
+/****
+* 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.bossRockets = [];
+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();
- boss.destroy();
- self.advanceLevel();
+ game.bossLasers[i].destroy();
+ game.bossLasers.splice(i, 1);
}
- };
- self.createBossLaser = function (boss) {
- var laser = new BossLaser();
- laser.x = boss.x;
- laser.y = boss.y + boss.height / 2;
- self.bossLasers.push(laser);
- self.addChild(laser);
- };
- self.currentLevel = 1;
- self.maxLevel = 5;
- self.levelDifficulty = [1, 2, 3, 4, 5];
- self.levelBossHealth = [100, 150, 200, 250, 300];
- var cityBackground = self.createAsset('cityBackground', 'City Background', 0, 0);
- cityBackground.width = 2048;
- cityBackground.height = 2732;
- self.addChildAt(cityBackground, 0);
- var ninjaHero = self.addChild(new NinjaHero());
- ninjaHero.x = 2048 / 2;
- ninjaHero.y = 2732 - ninjaHero.height;
- this.ninjaLasers = [];
- this.bossLasers = [];
- this.bossRockets = [];
- this.heroBullets = [];
- var boss = self.addChild(new Boss());
- boss.x = 2048 / 2;
- boss.y = 100;
- boss.health = self.levelBossHealth[self.currentLevel - 1];
- self.on('down', function (obj) {
- var event = obj.event;
- var pos = event.getLocalPosition(self);
- ninjaHero.x = pos.x;
- ninjaHero.y = pos.y;
- });
- self.advanceLevel = function () {
- if (self.currentLevel < self.maxLevel) {
- self.currentLevel++;
- boss.health = self.levelBossHealth[self.currentLevel - 1];
- } else {
- LK.showWin();
- }
- };
- LK.on('tick', function () {
- for (var i = self.ninjaLasers.length - 1; i >= 0; i--) {
- self.ninjaLasers[i].move();
- if (self.ninjaLasers[i].y < -50) {
- self.ninjaLasers[i].destroy();
- self.ninjaLasers.splice(i, 1);
- } else if (self.ninjaLasers[i].intersects(boss)) {
- self.manageBossHealth(boss, 100);
- self.ninjaLasers[i].destroy();
- self.ninjaLasers.splice(i, 1);
- }
- }
- for (var i = self.bossLasers.length - 1; i >= 0; i--) {
- self.bossLasers[i].move();
- if (self.bossLasers[i].y > 2732) {
- self.bossLasers[i].destroy();
- self.bossLasers.splice(i, 1);
- } else if (self.bossLasers[i].intersects(ninjaHero)) {
- LK.showGameOver();
- self.bossLasers[i].destroy();
- self.bossLasers.splice(i, 1);
- }
- }
- });
-});
+ }
+});
\ No newline at end of file
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.