User prompt
Have enemies flash white when they get hit
User prompt
Modify monsters. Monsters take three hero bullet to destroy
User prompt
Every enemy destroyed gets player one point to point tally
User prompt
Add point tally to top right of screen
User prompt
Show blast graphic for 0.5bseconds then destroy
User prompt
Include blast graphic when enemy destroys
User prompt
Reduce hero bullet frequency
User prompt
Change the hero shooting to just shoot consistently when player presses down
User prompt
Reduce opacity of background by 50%
User prompt
Reduce hero health item frequency
User prompt
Add background to display
User prompt
Hero bullet shoots into 3 bullets in rapid succession the pause in shooting for 0.5 seconds
User prompt
When player presses down on hero, hero shoots hero bullet
User prompt
Remove up and down movement to enemy
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'heroBullets[i].intersects')' in this line: 'if (heroBullets[i].intersects(enemies[j])) {' Line Number: 98
User prompt
add collision detection between each hero bullet and each enemy within the game's tick function, and then destroy the enemy and remove the bullet when a collision is detected.
User prompt
Reduce enemy spawn rate by 20%
User prompt
Implement suggestions above
User prompt
Have the up and down movement of the enemy random so that they all move separately
User prompt
Enemy graphic moves up and down by 100 pixels each way as it travels
User prompt
Enemy graphic rotates back and forth
User prompt
Reduce the frequency of health items
User prompt
Implement suggestions above
User prompt
Modify hero Health item replenishing health bar so to ensure that the health icon is restored in the same order it was removed.
User prompt
Allow hero to be dragged by player anywhere on the screen
var HeroHealthItem = Container.expand(function () { var self = Container.call(this); var healthItemGraphics = self.createAsset('heroHealthItem', 'Hero Health Item Graphics', .5, .5); self.speed = -5; self.move = function () { self.y += self.speed; if (self.y < 0) { self.destroy(); } }; }); var HeroBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('heroBullet', 'Hero Bullet Graphics', .5, .5); self.speed = 10; self.move = function () { self.x += self.speed; if (self.x > 2048) { self.destroy(); } }; }); var EnemyBullet = Container.expand(function () { var self = Container.call(this); var bulletGraphics = self.createAsset('enemyBullet', 'Enemy Bullet Graphics', .5, .5); self.speed = -10; self.move = function () { self.x += self.speed; }; }); var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.createAsset('hero', 'Hero Graphics', .5, .5); self.hitPoints = 5; self.hitPointIcons = []; self.takeDamage = function () { self.hitPoints--; if (self.hitPoints >= 0) { self.hitPointIcons[self.hitPoints].destroy(); self.hitPointIcons.splice(self.hitPoints, 1); } if (self.hitPoints <= 0) { LK.showGameOver(); } }; }); var Enemy = Container.expand(function () { var self = Container.call(this); var enemyGraphics = self.createAsset('enemy', 'Enemy Graphics', .5, .5); self.speed = 5 + Math.random() * 10; self.direction = 1; self.move = function () { self.x -= self.speed; self.y += self.direction * 5; if (self.y > 2732 - self.height || self.y < self.height) { self.direction *= -1; } }; }); var Game = Container.expand(function () { var self = Container.call(this); var background = self.createAsset('background', 'Game Background', 0, 0); background.width = 2048; background.height = 2732; background.alpha = 0.5; var dragNode = null; var shootingInterval; stage.on('down', function (obj) { dragNode = hero; shootingInterval = LK.setInterval(function () { var bullet = new HeroBullet(); bullet.x = hero.x; bullet.y = hero.y; heroBullets.push(bullet); self.addChild(bullet); }, 200); }); stage.on('up', function (obj) { dragNode = null; LK.clearInterval(shootingInterval); }); stage.on('move', function (obj) { if (dragNode) { var pos = obj.event.getLocalPosition(self); dragNode.x = pos.x; dragNode.y = pos.y; } }); stage.on('up', function (obj) { dragNode = null; }); var heroBullets = []; var enemyBullets = []; var enemies = []; var hero = self.addChild(new Hero()); hero.x = hero.width; hero.y = 2732 / 2; var hitPointIcons = []; for (var i = 0; i < hero.hitPoints; i++) { var hitPointIcon = LK.getAsset('hpIcon', 'HP Icon', 0, 0); hitPointIcon.x = i * hitPointIcon.width; hitPointIcon.y = 0; hero.hitPointIcons.push(hitPointIcon); LK.gui.topLeft.addChild(hitPointIcon); } var score = 0; var scoreText = new Text2(score.toString(), { size: 150, fill: '#ffffff' }); scoreText.anchor.set(1, 0); LK.gui.topRight.addChild(scoreText); LK.on('tick', function () { for (var i = 0; i < heroBullets.length; i++) { heroBullets[i].move(); if (heroBullets[i].x > 2048) { heroBullets[i].destroy(); heroBullets.splice(i, 1); } for (var j = 0; j < enemies.length; j++) { if (heroBullets[i] && heroBullets[i].intersects(enemies[j])) { var blast = self.createAsset('blast', 'Blast Graphics', .5, .5); blast.x = enemies[j].x; blast.y = enemies[j].y; self.addChild(blast); LK.setTimeout(function () { blast.destroy(); }, 500); enemies[j].destroy(); enemies.splice(j, 1); heroBullets[i].destroy(); heroBullets.splice(i, 1); break; } } } for (var i = 0; i < enemyBullets.length; i++) { enemyBullets[i].move(); if (enemyBullets[i].x < 0) { enemyBullets[i].destroy(); enemyBullets.splice(i, 1); } } for (var i = 0; i < enemies.length; i++) { enemies[i].move(); if (enemies[i].x + enemies[i].width < 0) { enemies[i].destroy(); enemies.splice(i, 1); } if (hero.intersects(enemies[i])) { hero.takeDamage(); enemies[i].destroy(); enemies.splice(i, 1); } } if (LK.ticks % 72 == 0) { var enemy = new Enemy(); enemy.x = 2048; enemy.y = Math.random() * (2732 - 2 * enemy.height); enemies.push(enemy); self.addChild(enemy); } if (LK.ticks % 1200 == 0) { var healthItem = new HeroHealthItem(); healthItem.x = Math.random() * (2048 - healthItem.width); healthItem.y = 2732; self.addChild(healthItem); } for (var i = 0; i < self.children.length; i++) { if (self.children[i] instanceof HeroHealthItem) { self.children[i].move(); if (hero.intersects(self.children[i])) { if (hero.hitPoints < 5) { hero.hitPoints++; var hitPointIcon = LK.getAsset('hpIcon', 'HP Icon', 0, 0); hitPointIcon.x = (hero.hitPoints - 1) * hitPointIcon.width; hitPointIcon.y = 0; hero.hitPointIcons.push(hitPointIcon); LK.gui.topLeft.addChild(hitPointIcon); } self.children[i].destroy(); } } } }); });
===================================================================
--- original.js
+++ change.js
@@ -102,8 +102,15 @@
hitPointIcon.y = 0;
hero.hitPointIcons.push(hitPointIcon);
LK.gui.topLeft.addChild(hitPointIcon);
}
+ var score = 0;
+ var scoreText = new Text2(score.toString(), {
+ size: 150,
+ fill: '#ffffff'
+ });
+ scoreText.anchor.set(1, 0);
+ LK.gui.topRight.addChild(scoreText);
LK.on('tick', function () {
for (var i = 0; i < heroBullets.length; i++) {
heroBullets[i].move();
if (heroBullets[i].x > 2048) {
Opossum in aviator cap, flying bi plane. Realistic Opossum , screaming opossum, ugly art style, meme, mouth open, side view Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Lovecraftian monster, eyeballs, tentacles, floating Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Opossum head, icon Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Cartoon overflowing trash can, game asset, floating Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Side view bullet blast, fireball, game asset Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Retro cityscape, pixel art 1930s, sky view, aerial view Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Gray red blob explosion, tentacles, eye balls, squelch Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.