User prompt
Remove sun, make galaxy 1.5 times smaller and rotate 5 times slower
User prompt
Make Galaxy 3 times bigger, and spin 6 times slower
User prompt
make Galaxy 6 times larger, and spin slowly counter clockwise
User prompt
add a new object Galaxy behind the Sun
User prompt
remove background
User prompt
add a background image filling the entire height and width of the stage
User prompt
make paddles and ball appear at the front of the screen
User prompt
Make dots be behind everything, and move 3 times slower
User prompt
make Sun 4 times larger
User prompt
make a big Sun object in the middle of a screen in the background
User prompt
make dots 2 times smaller and move 2 times slower
User prompt
add small white dots moving slowly across the screen in the background in random directions
Remix started
Copy Classic Pong
var Galaxy = Container.expand(function () { var self = Container.call(this); var galaxyGraphics = self.createAsset('galaxy', 'Galaxy Graphics', 0.5, 0.5); galaxyGraphics.scale.set(4); }); 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.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.x = Math.random() * 2048; self.y = Math.random() * 2732; } }; }); 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 sun = self.addChild(new Sun()); sun.x = 2048 / 2; sun.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(); } }); });
===================================================================
--- original.js
+++ change.js
@@ -1,4 +1,9 @@
+var Galaxy = Container.expand(function () {
+ var self = Container.call(this);
+ var galaxyGraphics = self.createAsset('galaxy', 'Galaxy Graphics', 0.5, 0.5);
+ galaxyGraphics.scale.set(4);
+});
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);
@@ -41,8 +46,11 @@
};
});
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 sun = self.addChild(new Sun());
sun.x = 2048 / 2;
sun.y = 2732 / 2;
var playerPaddle = self.addChildAt(new Paddle(), 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.