User prompt
Change bonus behavior - when clicked on, make it fade out, and add 3 to the score once
User prompt
after player clicks on bonus, make it fade out once
User prompt
after player clicks on bonus, make it smootly decrease in size and fade out
User prompt
make bonus reappear after being clicked on at a random point between 7 and 15 seconds
User prompt
after being clicked on, make bonus get smaller quickly and disappear
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'scale')' in this line: 'bonus.scale.x *= 1.01;' Line Number: 166
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'rotate')' in this line: 'bonus.rotate();' Line Number: 149
User prompt
make bonus first appear 7 seconds into the game
User prompt
make bonus only fade out if clicked on
User prompt
if you click on bonus, make it get smaller and fade out, and add 3 to the score
User prompt
make bonus appear above galaxy
User prompt
make bonus appear in a random spot near the middle of the screen
User prompt
make bonus appear a little bit closer to the middle of the stage
User prompt
add a true/false property to Paddles. If the paddle is moving up for longer than 0.1 seconds, then set it to true. If the paddle is moving down for longer than 0.1 seconds, then set it to false. each time If it is false, then mirror the object once. If its true, then mirror the object once
User prompt
add a true/false property to Paddles. If the paddle is moving up for longer than 0.1 seconds, then change it to true. If the paddle is moving down for longer than 0.1 seconds, then change it to false. each time it changes, mirror the paddle's asset
User prompt
add a true/false property to Paddles. If the paddle is moving up for longer than 0.1 seconds, then change it to true. If the paddle is moving down for longer than 0.1 seconds, then change it to false
User prompt
Mirror paddles vertically when they change direction that they are moving in
User prompt
remove particles object
User prompt
have particles fade out after 1.5 seconds
User prompt
destroy particles after 1.5 seconds
User prompt
make particles only appear each 4 tics
User prompt
make particles only appear each 0.1 second
User prompt
make particles disappear after 1.5 seconds
User prompt
Fix Bug: 'Uncaught Error: [object Object]addChildAt: The index 4 supplied is out of bounds 3' in this line: 'self.move = function () {' Line Number: 90
User prompt
make ball to be above particles
var Particles = Container.expand(function () { var self = Container.call(this); var particlesGraphics = self.createAsset('particles', 'Particles Graphics', 0.5, 0.5); self.speed = { x: (Math.random() * 10 - 5) / 6, y: (Math.random() * 10 - 5) / 6 }; self.move = function () { self.x += self.speed.x; self.y += self.speed.y; }; }); var Bonus = Container.expand(function () { var self = Container.call(this); var bonusGraphics = self.createAsset('bonus', 'Bonus Graphics', 0.5, 0.5); self.rotationSpeed = -0.01; self.rotate = function () { self.rotation += self.rotationSpeed; }; }); var Galaxy = Container.expand(function () { var self = Container.call(this); self.rotationSpeed = -0.00033333; var galaxyGraphics = self.createAsset('galaxy', 'Galaxy Graphics', 0.5, 0.5); galaxyGraphics.scale.set(12); self.scaleFactor = 0.0001; self.scaleDirection = 0.8; }); var Sun = Container.expand(function () { var self = Container.call(this); var sunGraphics = self.createAsset('sun', 'Sun Graphics', 0.5, 0.5); sunGraphics.scale.set(4); }); var Dot = Container.expand(function () { var self = Container.call(this); var dotGraphics = self.createAsset('dot', 'Dot Graphics', 0.5, 0.5); dotGraphics.scale.set(Math.random() * (0.5 - 0.3) + 0.3); var colors = [0xFFFFFF, 0xADD8E6, 0xFFFFE0]; dotGraphics.tint = colors[Math.floor(Math.random() * colors.length)]; self.speed = { x: (Math.random() * 10 - 5) / 6, y: (Math.random() * 10 - 5) / 6 }; self.alpha = 0; self.fadeIn = true; self.fadeOut = false; self.lifeTime = 0; self.maxLifeTime = Math.floor(Math.random() * (1200 - 300 + 1)) + 300; self.move = function () { self.x += self.speed.x * 0.9; self.y += self.speed.y * 0.9; self.lifeTime++; if (self.fadeIn) { self.alpha += 0.01; if (self.alpha >= 1) { self.fadeIn = false; } } else if (self.fadeOut) { self.alpha -= 0.01; if (self.alpha <= 0) { self.x = Math.random() * 2048; self.y = Math.random() * 2732; self.alpha = 0; self.fadeIn = true; self.fadeOut = false; self.lifeTime = 0; } } else if (self.lifeTime >= self.maxLifeTime) { self.fadeOut = true; } }; }); var Paddle = Container.expand(function () { var self = Container.call(this); var paddleGraphics = self.createAsset('paddle', 'Paddle Graphics', 0.5, 0.5); self.speed = 20; self.move = function (direction) { self.y += direction * self.speed; }; }); var Ball = Container.expand(function () { var self = Container.call(this); var ballGraphics = self.createAsset('ball', 'Ball Graphics', 0.5, 0.5); self.speed = { x: 10, y: 10 }; self.rotationSpeed = 0.01; self.rotationDirection = 1; self.move = function () { self.x += self.speed.x; self.y += self.speed.y; self.rotation += self.rotationSpeed * self.rotationDirection; }; }); var Game = Container.expand(function () { var self = Container.call(this); var galaxy = self.addChild(new Galaxy()); galaxy.x = 2048 / 2; galaxy.y = 2732 / 2; var playerPaddle = self.addChildAt(new Paddle(), self.children.length); var aiPaddle = self.addChildAt(new Paddle(), self.children.length); var ball = self.addChildAt(new Ball(), self.children.length); var bonus = self.addChildAt(new Bonus(), 0); bonus.x = Math.random() < 0.5 ? 0 : 2048; bonus.y = Math.random() < 0.5 ? 0 : 2732; var paddles = [playerPaddle, aiPaddle]; var score = 0; playerPaddle.x = 100; playerPaddle.y = 2732 / 2; aiPaddle.x = 2048 - 100; aiPaddle.y = 2732 / 2; ball.x = 2048 / 2; ball.y = 2732 / 2; var scoreTxt = new Text2('0', { size: 150, fill: "#ffffff" }); scoreTxt.anchor.set(.5, 0); LK.gui.topCenter.addChild(scoreTxt); var dots = []; for (var i = 0; i < 100; i++) { var dot = new Dot(); dot.x = Math.random() * 2048; dot.y = Math.random() * 2732; dots.push(dot); } for (var i = 0; i < dots.length; i++) { self.addChild(dots[i]); } var targetY = playerPaddle.y; stage.on('down', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); targetY = pos.y; }); stage.on('move', function (obj) { var event = obj.event; var pos = event.getLocalPosition(self); targetY = pos.y; }); LK.on('tick', function () { if (targetY < playerPaddle.y) { playerPaddle.move(-1); } else if (targetY > playerPaddle.y) { playerPaddle.move(1); } }); LK.on('tick', function () { ball.move(); if (LK.ticks % 4 == 0) { var particles = new Particles(); particles.x = ball.x; particles.y = ball.y; self.addChildAt(particles, self.children.length); } bonus.rotate(); var direction = ball.y - aiPaddle.y; direction = direction / Math.abs(direction); aiPaddle.move(direction * 0.5); for (var i = 0; i < paddles.length; i++) { if (ball.intersects(paddles[i])) { var hitPoint = ball.y - paddles[i].y; var hitRatio = hitPoint / paddles[i].height; ball.speed.y += hitRatio * 10; if (ball.speed.x > 0 && ball.x < paddles[i].x || ball.speed.x < 0 && ball.x > paddles[i].x) { ball.speed.x *= -1; ball.rotationDirection *= -1; } if (paddles[i] === playerPaddle) { score++; bonus.scale.x *= 1.01; bonus.scale.y *= 1.01; bonus.rotationSpeed *= 1.01; } } } if (ball.y <= 0 || ball.y >= 2732) { ball.speed.y *= -1; } if (ball.x <= 0) { LK.showGameOver(); } if (ball.x >= 2048) { score++; ball.x = 2048 / 2; ball.y = 2732 / 2; ball.speed.x = 10; ball.speed.y = 10; } scoreTxt.setText(score.toString()); for (var i = 0; i < dots.length; i++) { dots[i].move(); } galaxy.rotation += galaxy.rotationSpeed; galaxy.scale.x += galaxy.scaleFactor * galaxy.scaleDirection; galaxy.scale.y += galaxy.scaleFactor * galaxy.scaleDirection; if (galaxy.scale.x > 1.2 || galaxy.scale.x < 0.8) { galaxy.scaleDirection *= -1; } }); });
===================================================================
--- original.js
+++ change.js
@@ -147,9 +147,9 @@
}
});
LK.on('tick', function () {
ball.move();
- if (LK.ticks % 6 == 0) {
+ if (LK.ticks % 4 == 0) {
var particles = new Particles();
particles.x = ball.x;
particles.y = ball.y;
self.addChildAt(particles, self.children.length);
2d earth Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
white star, no background, pixelart Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Galaxy pixelart in black background Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
pixelart of a tall and thin spaceship, no background Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
sun pixelart Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
white circle, no background Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
3 yellow sparkles, pixelart, no background Single Game Texture. In-Game asset. 2d. High contrast. No shadows.
simple black circle no background Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Green microchip pixelart Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
number 10, golden color, pixelart Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.