User prompt
Remove the faster indicator
User prompt
Move the faster indicator up and to the left 100
User prompt
Make the punches go faster when the speed increases
User prompt
Fix Bug: 'TypeError: undefined is not an object (evaluating 'Opponent.prototype')' in this line: 'Opponent.prototype.baseSpeed = 3;' Line Number: 1
User prompt
The speed multiplier doesn’t seem to affect the enemies or gloves
User prompt
Make the increase more pronounced
User prompt
When the speed increases flash the word “faster” in the middle of the screen for a second
User prompt
Every 5 seconds speed up the enemies and gloves
User prompt
When an enemy hits the boxer the game is over
User prompt
Flip the enemies
User prompt
Set the score to the glove kill count
User prompt
Create a variable to track each time a glove kills an enemy
User prompt
Fix Bug: 'TypeError: parseInt is not a function. (In 'parseInt(scoreTxt.text)', 'parseInt' is undefined)' in this line: 'scoreTxt.text = parseInt(scoreTxt.text) + 1;' Line Number: 104
User prompt
Fix Bug: 'TypeError: scoreTxt.getText is not a function. (In 'scoreTxt.getText()', 'scoreTxt.getText' is undefined)' in this line: 'scoreTxt.setText(parseInt(scoreTxt.getText()) + 1);' Line Number: 104
User prompt
Fix Bug: 'TypeError: parseInt is not a function. (In 'parseInt(scoreTxt.text)', 'parseInt' is undefined)' in this line: 'scoreTxt.setText(parseInt(scoreTxt.text) + 1);' Line Number: 104
User prompt
Add one to the score every time an enemy dies
User prompt
When an enemy is hit it should move away from the player in the direction of the glove
User prompt
Delete enemies that die
User prompt
When a boxing glove hits an enemy it should move the enemy backwards by 100 pixels. Each enemy has 3 hit points and should disappear after they lose their hp
User prompt
Make the enemies a little smaller and they should move towards the player
User prompt
Make little opponents that spawn from the right edge of the screen
User prompt
Scale the background so it fills the screen
User prompt
Add a background that looks like a boxing ring
User prompt
Fix Bug: 'ReferenceError: Can't find variable: dy' in this line: 'var angle = Math.atan2(dy, dx);' Line Number: 32
User prompt
Fix Bug: 'ReferenceError: Can't find variable: dy' in this line: 'var angle = Math.atan2(dy, dx);' Line Number: 30
var Opponent = Container.expand(function () { var self = Container.call(this); var opponentGraphics = self.createAsset('opponent', 'Opponent Graphics', .5, .5); opponentGraphics.scale.set(4); self.speed = -3; self.move = function () { self.x += self.speed; }; }); 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 = 15; }); 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 scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); LK.gui.topCenter.addChild(scoreTxt); var isGameOver = false; var tickOffset = 0; 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(); } if (opponentSpawnCounter++ >= opponentSpawnRate) { var opponent = new Opponent(); 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(); 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,4 +1,13 @@
+var Opponent = Container.expand(function () {
+ var self = Container.call(this);
+ var opponentGraphics = self.createAsset('opponent', 'Opponent Graphics', .5, .5);
+ opponentGraphics.scale.set(4);
+ self.speed = -3;
+ self.move = function () {
+ self.x += self.speed;
+ };
+});
var Hero = Container.expand(function () {
var self = Container.call(this);
var heroGraphics = self.createAsset('hero', 'Hero character', .5, .5);
heroGraphics.scale.set(6);
@@ -35,8 +44,11 @@
self.addChildAt(background, 0);
var hero = self.addChild(new Hero());
var enemies = [];
var punches = [];
+ var opponents = [];
+ var opponentSpawnRate = 120;
+ var opponentSpawnCounter = 0;
var scoreTxt = new Text2('0', {
size: 150,
fill: "#ffffff"
});
@@ -67,8 +79,24 @@
for (var i = punches.length - 1; i >= 0; i--) {
var punch = punches[i];
punch.move();
}
+ if (opponentSpawnCounter++ >= opponentSpawnRate) {
+ var opponent = new Opponent();
+ 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();
+ if (opponent.x + opponent.width / 2 < 0) {
+ opponent.destroy();
+ opponents.splice(j, 1);
+ }
+ }
if (isGameOver) {
LK.effects.flashScreen(0xff0000, 1000);
LK.showGameOver();
}
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.