User prompt
the star should self destruct after 3 seconds on screen.
User prompt
Make the star only ever appear on the right half of the screen
User prompt
Add 10 points to the score when the punch hits the star
User prompt
Create a star that appears every 5 seconds. It should stay on screen for 3 seconds and then be destroyed. If a punch hits the star destroy all enemies.
User prompt
Remove the stars
User prompt
When a glove hits a star destroy the star
User prompt
Make the gloves move faster
User prompt
When a.glove hits a star add.10 points
User prompt
A fist hitting the star should make the screen flash
User prompt
When a glove hits the star destroy all enemies, then destroy the glove and the star
User prompt
Destroy the glove and star when they collide
User prompt
If a glove hits the star, destroy all the enemies and reset the global speed to its starting value
User prompt
Make the star bigger
User prompt
The star should only ever appear in the vertical middle 70 percent of the screen
User prompt
Add a delay of at least 4 seconds after a.star spawns before the next one does
User prompt
Make the stars spawn less frequently
User prompt
At random intervals add a star somewhere on the right half of the screen, it should stay on the screen for two seconds and then destroy itself
User prompt
Every time an enemy is defeated increase the punch speed and knock back
User prompt
Every time an enemy is defeated increase the enemy speed by 1
User prompt
Make the gloves twice as fast
User prompt
Make the gloves faster
User prompt
Fix Bug: 'ReferenceError: globalSpeed is not defined' in this line: 'self.speed = globalSpeed;' Line Number: 5
User prompt
Make a global speed variable that is added to enemies and gloves
User prompt
Every time a new enemy spawns it should be a little faster than the last
User prompt
Increase the opponent self speed by 1 every 5 seconds
var globalSpeed = 5; var Star = Container.expand(function () { var self = Container.call(this); var starGraphics = self.createAsset('star', 'Star Graphics', .5, .5); starGraphics.scale.set(2); self.lifetime = 3000; self.spawnTime = LK.ticks; }); var Opponent = Container.expand(function () { var self = Container.call(this); var opponentGraphics = self.createAsset('opponent', 'Opponent Graphics', .5, .5); opponentGraphics.scale.set(-3, 3); self.speed = globalSpeed; self.hitPoints = 3; self.move = function (heroX, heroY) { var dx = heroX - self.x; var dy = heroY - self.y; var distance = Math.sqrt(dx * dx + dy * dy); self.x += self.speed * (dx / distance); self.y += self.speed * (dy / distance); }; self.hit = function (punchX, punchY) { self.hitPoints--; var dx = self.x - punchX; var dy = self.y - punchY; var distance = Math.sqrt(dx * dx + dy * dy); var knockBackMultiplier = 1.2; self.x += 100 * knockBackMultiplier * (dx / distance); self.y += 100 * knockBackMultiplier * (dy / distance); if (self.hitPoints <= 0) { globalSpeed += 1; Punch.prototype.speed += 1; self.destroy(); } }; }); var Hero = Container.expand(function () { var self = Container.call(this); var heroGraphics = self.createAsset('hero', 'Hero character', .5, .5); heroGraphics.scale.set(6); self.speed = 5; self.move = function () {}; self.punch = function () {}; }); var Punch = Container.expand(function () { var self = Container.call(this); self.velocity = { x: 0, y: 0 }; self.setVelocity = function (targetX, targetY) { var dx = targetX - self.x; var dy = targetY - self.y; var distance = Math.sqrt(dx * dx + dy * dy); self.velocity.x = self.speed * (dx / distance); self.velocity.y = self.speed * (dy / distance); }; self.move = function () { self.x += self.velocity.x; self.y += self.velocity.y; }; var punchGraphics = self.createAsset('punch', 'Punch Graphics', .5, .5); punchGraphics.scale.set(2); punchGraphics.rotation = Math.PI / 2; self.speed = globalSpeed * 3; }); var Game = Container.expand(function () { var self = Container.call(this); var background = self.createAsset('boxingRing', 'Boxing Ring Background', 0, 0); background.scale.set(LK.stage.width / background.width, LK.stage.height / background.height); self.addChildAt(background, 0); var hero = self.addChild(new Hero()); var enemies = []; var punches = []; var opponents = []; var opponentSpawnRate = 120; var opponentSpawnCounter = 0; var lastStarSpawnTime = 0; var star = null; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); LK.gui.topCenter.addChild(scoreTxt); var isGameOver = false; var tickOffset = 0; var glovesKillsCount = 0; var speedIncreaseTimer = 0; var speedIncreaseInterval = 300; var speedMultiplier = 1; hero.x = hero.width / 2; hero.y = 2732 / 2; var punchCooldown = 500; var lastPunchTime = 0; LK.stage.on('down', function (obj) { var currentTime = Date.now(); if (currentTime - lastPunchTime >= punchCooldown) { var event = obj.event; var tapPosition = event.getLocalPosition(self); var punch = new Punch(); punch.x = hero.x; punch.y = hero.y; punch.setVelocity(tapPosition.x, tapPosition.y); punches.push(punch); self.addChild(punch); LK.effects.flashObject(hero, 0xffcc00, 100); lastPunchTime = currentTime; } }); LK.on('tick', function () { hero.move(); for (var i = punches.length - 1; i >= 0; i--) { var punch = punches[i]; punch.move(); var starHit = false; for (var j = opponents.length - 1; j >= 0; j--) { var opponent = opponents[j]; if (star && punch.intersects(star)) { starHit = true; star.destroy(); glovesKillsCount += 10; scoreTxt.setText(glovesKillsCount.toString()); star = null; } else if (punch.intersects(opponent)) { opponent.hit(punch.x, punch.y); if (opponent.hitPoints <= 0) { glovesKillsCount++; scoreTxt.setText(glovesKillsCount.toString()); opponents.splice(j, 1); } starHit = false; punch.destroy(); punches.splice(i, 1); break; } } if (starHit) { opponents.forEach(function (opponent) { opponent.destroy(); }); opponents = []; globalSpeed = 5; Punch.prototype.speed = globalSpeed * 2; } } if (star && LK.ticks - star.spawnTime > star.lifetime) { star.destroy(); star = null; } if (!star && LK.ticks - lastStarSpawnTime >= 5 * 60) { star = new Star(); star.x = LK.stage.width / 2 + Math.random() * (LK.stage.width / 2); star.y = LK.stage.height / 2; self.addChild(star); lastStarSpawnTime = LK.ticks; } speedIncreaseTimer++; if (speedIncreaseTimer >= speedIncreaseInterval) { if (LK.ticks % (5 * 60) === 0) { speedMultiplier += 0.2; } globalSpeed *= speedMultiplier; speedIncreaseTimer = 0; } if (opponentSpawnCounter++ >= opponentSpawnRate) { var opponent = new Opponent(); opponent.speed += 0.5; opponent.x = LK.stage.width; opponent.y = Math.random() * (LK.stage.height - opponent.height) + opponent.height / 2; opponents.push(opponent); self.addChild(opponent); opponentSpawnCounter = 0; } for (var j = opponents.length - 1; j >= 0; j--) { var opponent = opponents[j]; opponent.move(hero.x, hero.y); if (opponent.intersects(hero)) { isGameOver = true; } if (opponent.x + opponent.width / 2 < 0) { opponent.destroy(); opponents.splice(j, 1); } } if (isGameOver) { LK.effects.flashScreen(0xff0000, 1000); LK.showGameOver(); } }); });
===================================================================
--- original.js
+++ change.js
@@ -148,9 +148,9 @@
star = null;
}
if (!star && LK.ticks - lastStarSpawnTime >= 5 * 60) {
star = new Star();
- star.x = LK.stage.width / 2;
+ star.x = LK.stage.width / 2 + Math.random() * (LK.stage.width / 2);
star.y = LK.stage.height / 2;
self.addChild(star);
lastStarSpawnTime = LK.ticks;
}
Boxing glove, pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
A golden glowing star, pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art "bap!" explosion Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art explosion that says "TKO" Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
ball of fire sprite art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
a cute anthropomorphic cat wearing boxing shorts and boxing gloves, pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixel art view from inside boxing ring, floor near middle of image Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
anthropomorphic dog wearing boxing shorts and boxing gloves, boxer, pixel art Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.