User prompt
change ball to move 1.5% faster each time the score goes up
User prompt
change ball to only move 1.5% faster each time the score goes up
User prompt
each time the score goes up, increase AI paddle's maximum speed by 4%
User prompt
make ball move faster by 3% each time the score goes up
User prompt
make ball move faster by 5% each time the score goes up
User prompt
if score is 10 or above, make ball move 1.3 times faster
User prompt
make ball slowly rotate and change what direction it rotates each time it hits a paddle
User prompt
make ball slowly rotate clockwise and rotate counter clockwise when it hits AI paddle
User prompt
make bonus only appear in top left or bottom left
User prompt
make bonus only appear in top left or bottom left
User prompt
If Player's paddle is near the sun, make sun disappear, and add 5 to the score
User prompt
add new object Bonus to be either at the top left or bottom left of the screen
User prompt
Fix Bug: 'Uncaught TypeError: Graphics is not a constructor' in this line: 'var scoreBackground = new Graphics();' Line Number: 89
User prompt
Add a black square behind the score
User prompt
make Score's font to be bold and pixelated
User prompt
make galaxy change size 10 times slower
User prompt
make Galaxy increase and decrease in size 10 times slower, as well as make it increase or decrease from 0.8 to 1.2 of its size
User prompt
make Galaxy slowly increase and then decrease in size, and then go back to normal size
User prompt
make ai paddle move smoother
User prompt
make dots be either white, light blue, or pastel yellow in color
User prompt
make some dots slightly smaller than others
User prompt
Each time ball touches player's paddle, add 1 to the score
User prompt
make dots randomly fade out and disappear after being on the screen for 5 to 20 seconds
User prompt
before appearing on the screen, make dots fade in slowly. Also make them fade out and disappear after being on the screen for 15 seconds
User prompt
Before disappearing, make dots fade out of existence
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); }); 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(0.5); 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.move = function () { self.x += self.speed.x; self.y += self.speed.y; 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 >= 900) { 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.move = function () { self.x += self.speed.x; self.y += self.speed.y; }; }); 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 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 (ball.y < aiPaddle.y) { aiPaddle.move(-1); } else if (ball.y > aiPaddle.y) { aiPaddle.move(1); } 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; } } } 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; }); });
===================================================================
--- original.js
+++ change.js
@@ -16,18 +16,33 @@
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.move = function () {
self.x += self.speed.x;
self.y += self.speed.y;
- if (self.x < 0 || self.x > 2048 || self.y < 0 || self.y > 2732) {
+ 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 = 1;
+ self.alpha = 0;
+ self.fadeIn = true;
+ self.fadeOut = false;
+ self.lifeTime = 0;
}
+ } else if (self.lifeTime >= 900) {
+ self.fadeOut = true;
}
};
});
var Paddle = Container.expand(function () {
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.