User prompt
make it so that every time either ball2 or ball2 is randomly born with equal probability.
User prompt
make it so that every time either ball2 or ball2 is randomly born with equal probability.
User prompt
make it so that every time either ball2 or ball2 is randomly born with equal probability.
User prompt
make it so that either ball or ball2 is born randomly with equal probability, each new birth is randomized
User prompt
make it so that either ball or ball2 is born randomly with equal probability, each new birth is randomized
User prompt
make it so that either ball or ball2 is randomly born with equal probability.
User prompt
make the ball or ball2 randomly spawn.
User prompt
make the ball or ball2 randomly spawn.
User prompt
make it equally likely that a ball or a ball2 will be born.
User prompt
make it equally likely that a ball or a ball2 will be born.
User prompt
The angle of the ball should change more after collisions with the paddles.
User prompt
Make the ball speed faster.
User prompt
make the direction of the ball random after birth
User prompt
the ball must not go through the paddles
User prompt
remove the autocontrol, mouse control only.
User prompt
each of the paddles must be a separate item in the sets
User prompt
each of the paddles must be a separate item in the sets
User prompt
put the background on the lowest layer
User prompt
put the background in the game.
User prompt
put the background in the game.
Initial prompt
Pong
===================================================================
--- original.js
+++ change.js
@@ -1,9 +1,9 @@
/****
* Classes
****/
-// Paddle class
-var Paddle = Container.expand(function () {
+// RightPaddle class
+var RightPaddle = Container.expand(function () {
var self = Container.call(this);
var paddleGraphics = self.attachAsset('paddle', {
anchorX: 0.5,
anchorY: 0.5
@@ -15,8 +15,23 @@
self.moveDown = function () {
self.y += self.speed;
};
});
+// LeftPaddle class
+var LeftPaddle = Container.expand(function () {
+ var self = Container.call(this);
+ var paddleGraphics = self.attachAsset('paddle', {
+ anchorX: 0.5,
+ anchorY: 0.5
+ });
+ self.speed = 10;
+ self.moveUp = function () {
+ self.y -= self.speed;
+ };
+ self.moveDown = function () {
+ self.y += self.speed;
+ };
+});
// Ball class
var Ball = Container.expand(function () {
var self = Container.call(this);
var ballGraphics = self.attachAsset('ball', {
@@ -71,11 +86,11 @@
// Instantiate and add background to the game
var background = game.addChild(new Background());
// Define the ball asset
// Define the paddle asset
-// Initialize paddles and ball
-var leftPaddle = game.addChild(new Paddle());
-var rightPaddle = game.addChild(new Paddle());
+// Initialize paddles
+var leftPaddle = game.addChild(new LeftPaddle());
+var rightPaddle = game.addChild(new RightPaddle());
var ball = game.addChild(new Ball());
// Set initial positions
leftPaddle.x = 50;
leftPaddle.y = 2732 / 2;
ancient nautical chart. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
head of the wind god that blows wind on ancient maps, Middle Ages, black and white, wind from the mouth. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
scrub
pirate treasure chest. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
anchor. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
cannonball. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
explosion, black and white. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.