User prompt
Ball should only be able to go back up when it's headed down toward the bottom when the paddle hits the ball If the ball reaches the bottom of the screen the game is over
User prompt
Blocks should span the width of the playing area
User prompt
Add a background image
User prompt
Prevent the ball from going out of balance I'm talking
User prompt
The ball should fly upward toward the blocks as it bounces off the walls
User prompt
Ball should move upward toward the blocks to break out
User prompt
ball should bounce against the walls up toward the top of the playable area to break out the blocks
User prompt
Expand the breakout blocks to the width of the entire playing area
User prompt
Make the breakout area the entire width of the playing canvas
User prompt
Add a background image that covers the entire width and height of the playing area
Initial prompt
Noodles' Escape from Prison
/****
* Classes
****/
// Ball class
var Ball = Container.expand(function () {
var self = Container.call(this);
var ballGraphics = self.attachAsset('ball', {
anchorX: 0.5,
anchorY: 0.5
});
self.width = ballGraphics.width;
self.height = ballGraphics.height;
self.speedX = 5;
self.speedY = 5;
self.update = function () {
self.x += self.speedX;
self.y += self.speedY;
// Ball collision with walls
if (self.x <= 0 || self.x >= 2048) {
self.speedX *= -1;
}
if (self.y <= 0) {
self.speedY *= -1;
}
};
});
// Brick class
var Brick = Container.expand(function () {
var self = Container.call(this);
var brickGraphics = self.attachAsset('brick', {
anchorX: 0.5,
anchorY: 0.5
});
self.width = brickGraphics.width;
self.height = brickGraphics.height;
self.update = function () {
// Brick update logic if needed
};
});
//<Assets used in the game will automatically appear here>
// Paddle class
var Paddle = Container.expand(function () {
var self = Container.call(this);
var paddleGraphics = self.attachAsset('paddle', {
anchorX: 0.5,
anchorY: 0.5
});
self.width = paddleGraphics.width;
self.height = paddleGraphics.height;
self.update = function () {
// Paddle update logic if needed
};
});
/****
* Initialize Game
****/
var game = new LK.Game({
backgroundColor: 0x000000 //Init game with black background
});
/****
* Game Code
****/
// Initialize paddle
var paddle = game.addChild(new Paddle());
paddle.x = 2048 / 2;
paddle.y = 2500;
// Initialize ball
var ball = game.addChild(new Ball());
ball.x = 2048 / 2;
ball.y = 2400;
// Initialize bricks
var bricks = [];
var rows = 5;
var cols = 10;
var brickWidth = 150;
var brickHeight = 50;
var padding = 10;
for (var r = 0; r < rows; r++) {
for (var c = 0; c < cols; c++) {
var brick = new Brick();
brick.x = c * (brickWidth + padding) + brickWidth / 2 + padding;
brick.y = r * (brickHeight + padding) + brickHeight / 2 + padding;
bricks.push(brick);
game.addChild(brick);
}
}
// Handle paddle movement
var dragNode = null;
game.down = function (x, y, obj) {
if (y > 2000) {
dragNode = paddle;
}
};
game.move = function (x, y, obj) {
if (dragNode) {
dragNode.x = x;
}
};
game.up = function (x, y, obj) {
dragNode = null;
};
// Game update logic
game.update = function () {
ball.update();
paddle.update();
for (var i = 0; i < bricks.length; i++) {
bricks[i].update();
// Ball collision with bricks
if (ball.intersects(bricks[i])) {
ball.speedY *= -1;
bricks[i].destroy();
bricks.splice(i, 1);
i--;
}
}
// Ball collision with paddle
if (ball.intersects(paddle)) {
ball.speedY *= -1;
}
// Ball out of bounds
if (ball.y > 2732) {
LK.showGameOver();
}
};
Prison cell bars. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Super fat cat with a funny face wearing a prison jumpsuit. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Top down view of a Dirty prison floor. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.