User prompt
add scorebackground above sun
User prompt
move sun 10 pixels down
User prompt
move sun 70 pixels down
User prompt
add sun 50 pixels down from the top of the screen
User prompt
change score's font to Franklin Gothic Demi
User prompt
change score's font to Berlin Sans FB Demi
User prompt
Change score's font to arial black
User prompt
explosions to fade out 2 times faster
User prompt
explosions to fade out 2 times faster
User prompt
explosions to fade out 2 times faster
User prompt
change explosions to scale down 3 times quicker
User prompt
A new object called explosion. Make 8 of them appear at a paddle if paddle and ball collide,and move in a random direction before disappearing in 0.1 second
User prompt
Fix Bug: 'ReferenceError: galaxy is not defined' in this line: 'galaxy.rotation += galaxy.rotationSpeed;' Line Number: 244
User prompt
remove asset background
User prompt
make the ball move in a random direction at the start of the game
User prompt
make the ball move in a random direction at the start of the game
User prompt
initial ball direction to be random
User prompt
Change ball's initial direction to random direction to the right
User prompt
when ball appears at the start of the game, have ball move in a random direction to the right
User prompt
when ball appears, have ball move in a random direction to the right
User prompt
each time ball reappears, set it's trajectory in a random direction to the right
User prompt
each 0.1 second, add a particle under ball, and have them scale down and disappear after 1.5 second
User prompt
Each 0.1 second add particles under ball, and then have it scale down in size and disappear after 1.5 seconds
User prompt
have player's paddle asset to have a tint of a random color at the start
User prompt
Each time the score increased, change player's paddle asset to have a tint of a random color
var Explosion = Container.expand(function () { var self = Container.call(this); var explosionGraphics = self.createAsset('explosion', 'Explosion 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; }; self.fadeOut = function () { self.alpha -= 0.02; if (self.alpha <= 0) { self.destroy(); } }; }); var Particle = Container.expand(function () { var self = Container.call(this); var particleGraphics = self.createAsset('particle', 'Particle Graphics', 0.5, 0.5); self.scale.set(1); self.fadeSpeed = 1 / 150; self.scaleSpeed = 1 / 150; self.update = function () { self.alpha -= self.fadeSpeed; self.scale.x -= self.scaleSpeed; self.scale.y -= self.scaleSpeed; if (self.alpha <= 0) { self.destroy(); } }; }); 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.fadeSpeed = 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, 0xEDDEA4, 0xEDDEA4]; 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 PlayerPaddle = Container.expand(function () { var self = Container.call(this); var paddleGraphics = self.createAsset('paddle', 'Player Paddle Graphics', 0.5, 0.5); paddleGraphics.tint = Math.floor(Math.random() * 16777215); self.speed = 20; self.move = function (direction) { self.y += direction * self.speed; }; }); var AIPaddle = Container.expand(function () { var self = Container.call(this); var paddleGraphics = self.createAsset('paddle', 'AI Paddle Graphics', 0.5, 0.5); paddleGraphics.tint = 0xE63946; 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 PlayerPaddle(), self.children.length); var aiPaddle = self.addChildAt(new AIPaddle(), self.children.length); var ball = self.addChildAt(new Ball(), self.children.length); var bonus; function createBonus() { bonus = self.addChildAt(new Bonus(), self.children.length); bonus.x = (Math.random() * 0.2 + 0.4) * 2048; bonus.y = (Math.random() * 0.2 + 0.4) * 2732; bonus.scale.set(0.01); var scaleInterval = LK.setInterval(function () { bonus.scale.x += 0.03; bonus.scale.y += 0.03; if (bonus.scale.x >= 1) { LK.clearInterval(scaleInterval); } }, 200 / 60); bonus.on('down', function () { var scaleDownInterval = LK.setInterval(function () { bonus.scale.x -= 0.1; bonus.scale.y -= 0.1; if (bonus.scale.x <= 0) { LK.clearInterval(scaleDownInterval); bonus.alpha = 0; score += 3; bonus.destroy(); var bonusDelay = Math.floor(Math.random() * (15000 - 7000 + 1)) + 7000; LK.setTimeout(createBonus, bonusDelay); } }, 200 / 60); }); } var bonusDelay = Math.floor(Math.random() * (15000 - 7000 + 1)) + 7000; LK.setTimeout(createBonus, bonusDelay); 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 % 6 == 0) { var particle = new Particle(); particle.x = ball.x; particle.y = ball.y; self.addChild(particle); } if (bonus) { 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; for (var j = 0; j < 8; j++) { var explosion = new Explosion(); explosion.x = paddles[i].x; explosion.y = paddles[i].y; self.addChild(explosion); } } if (paddles[i] === playerPaddle) { score++; var randomColor = Math.floor(Math.random() * 16777215); playerPaddle.children[0].tint = randomColor; if (bonus) { 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 = Math.random() * 20 - 10; } scoreTxt.setText(score.toString()); for (var i = 0; i < dots.length; i++) { dots[i].move(); } for (var i = self.children.length - 1; i >= 0; i--) { if (self.children[i] instanceof Particle) { self.children[i].update(); } if (self.children[i] instanceof Explosion) { self.children[i].move(); self.children[i].fadeOut(); } } 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
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.