User prompt
can you make particles come out the back of the punch?
User prompt
Make sure I can't hit the star when it disappears. When it disappears it should be gone for a couple seconds and then appear again at a new random location
User prompt
The star should spawn on the right 2/3 of the screen and in the vertical middle 80% of the screen
User prompt
make sure the tko graphic always appears fully on screen
User prompt
Maybe only make the TKO scale 10
User prompt
Make the TKO graphic 5 times bigger when it appears
User prompt
Also flash the screen when the star is hit
User prompt
When a punch hits the star pawn a "TKO" graphic that fades out over 1 second
User prompt
Make the flung opponents rotate quickly while flying off the screen
User prompt
When the flung opponent is created make sure the original enemy graphic is destroyed.
User prompt
When the star is hit delete all enemies
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'indexOf')' in this line: 'var index = self.parent.opponents.indexOf(self);' Line Number: 74
User prompt
The hit graphic that appears when an enemy dies should be twice as big as the normal hit
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'indexOf')' in this line: 'var index = self.parent.opponents.indexOf(self);' Line Number: 74
User prompt
When destroying an enemy make sure the original enemy i deleted from the screen
User prompt
Change the star logic entirely. A new star should spawn every 6 seconds and stay for 3 seconds. When a punch hits the star make all the enemies spin off the screen to the right.
User prompt
The star doesn't reappear
User prompt
After being hit the tar should wait 4 seconds then chooe a new random position on the right half of the screen and reappear
User prompt
The star should move after each time it disappears. When it is inviible I houldn't be able to hit it
User prompt
When an enemy is destroyed by the star make them fly off the screen to the right before being destroyed.
User prompt
When an enemy dies create a hitgraphic that is 3x the size at the location they died.
User prompt
When an enemy dies, make it fly spinning off to the left before it is destroyed.
User prompt
Make the hit graphic twice as big. It should start at 100 percent opacity and fade out in 1 second
User prompt
The hit graphic should appear at the midpoint between the enemy and punch
User prompt
When the punch hits an enemy spawn a flashing hit graphic for a second
var globalSpeed = 5; var HitGraphic = Container.expand(function () { var self = Container.call(this); var hitGraphic = self.createAsset('hit', 'Hit Graphic', .5, .5); hitGraphic.scale.set(3); hitGraphic.alpha = 1; var fadeOutInterval = LK.setInterval(function () { hitGraphic.alpha -= 0.0167; if (hitGraphic.alpha <= 0) { LK.clearInterval(fadeOutInterval); self.destroy(); } }, 16.67); LK.setTimeout(function () { self.destroy(); }, 1000); }); 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; LK.setTimeout(function () { self.destroy(); }, self.lifetime); }); 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; var hitGraphic = new HitGraphic(); hitGraphic.x = self.x; hitGraphic.y = self.y; self.parent.addChild(hitGraphic); 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); } else { var hitGraphic = new HitGraphic(); hitGraphic.x = (opponent.x + punch.x) / 2; hitGraphic.y = (opponent.y + punch.y) / 2; self.addChild(hitGraphic); LK.effects.flashObject(hitGraphic, 0xffffff, 1000); } 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 - 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
@@ -1,19 +1,5 @@
var globalSpeed = 5;
-var SpinningOpponent = Container.expand(function () {
- var self = Container.call(this);
- var opponentGraphics = self.createAsset('opponent', 'Opponent Graphics', .5, .5);
- opponentGraphics.scale.set(-3, 3);
- self.rotationSpeed = 0.1;
- self.flyOffSpeed = -15;
- self.update = function () {
- self.x += self.flyOffSpeed;
- self.rotation += self.rotationSpeed;
- if (self.x + self.width / 2 < 0) {
- self.destroy();
- }
- };
-});
var HitGraphic = Container.expand(function () {
var self = Container.call(this);
var hitGraphic = self.createAsset('hit', 'Hit Graphic', .5, .5);
hitGraphic.scale.set(3);
@@ -62,12 +48,12 @@
self.y += 100 * knockBackMultiplier * (dy / distance);
if (self.hitPoints <= 0) {
globalSpeed += 1;
Punch.prototype.speed += 1;
- var spinningOpponent = new SpinningOpponent();
- spinningOpponent.x = self.x;
- spinningOpponent.y = self.y;
- self.parent.addChild(spinningOpponent);
+ var hitGraphic = new HitGraphic();
+ hitGraphic.x = self.x;
+ hitGraphic.y = self.y;
+ self.parent.addChild(hitGraphic);
self.destroy();
}
};
});
@@ -212,11 +198,9 @@
}
for (var j = opponents.length - 1; j >= 0; j--) {
var opponent = opponents[j];
opponent.move(hero.x, hero.y);
- if (opponent instanceof SpinningOpponent) {
- opponent.update();
- } else if (opponent.intersects(hero)) {
+ if (opponent.intersects(hero)) {
isGameOver = true;
}
if (opponent.x + opponent.width / 2 < 0) {
opponent.destroy();
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.