Firefox Breakout Guide
How do I make an firefox breakout guide?
What is a firefox breakout guide? How do you make a firefox breakout guide? This script and codes were developed by Quincy Soeliman on 22 July 2022, Friday.
Firefox Breakout Guide - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Firefox Breakout Guide</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <canvas id="myCanvas" width="480" height="320"></canvas> <script src="js/index.js"></script>
</body>
</html>
Firefox Breakout Guide - Script Codes CSS Codes
* { margin: 0; padding: 0;
}
canvas { display: block; margin: 0 auto; background: #eee;
}
Firefox Breakout Guide - Script Codes JS Codes
var canvas = document.getElementById('myCanvas');
var ctx = canvas.getContext('2d');
// Ball vars.
var x = canvas.width / 2;
var y = canvas.height - 30;
var dx = 2;
var dy = -2;
var ballRadius = 10;
// Player vars.
var playerSpeed = 3;
var paddleWidth = 75;
var paddleHeight = 10;
var paddleX = (canvas.width - paddleWidth) / 2;
var rightPressed = false;
var leftPressed = false;
// Brick vars.
var brickRowCount = 3;
var brickColumnCount = 5;
var brickWidth = 75;
var brickHeight = 20;
var brickPadding = 10;
var brickOffsetTop = 30;
var brickOffsetLeft = 30;
// Create bricks array.
var bricks = [];
for (c = 0; c < brickColumnCount; c++) { bricks[c] = []; for (r = 0; r < brickRowCount; r++) { bricks[c][r] = { x: 0, y: 0 }; }
}
function drawBricks() { for (c = 0; c < brickColumnCount; c++) { for (r = 0; r < brickRowCount; r++) { var brickX = (c * (brickWidth + brickPadding)) + brickOffsetLeft; var brickY = (r * (brickHeight + brickPadding)) + brickOffsetTop; bricks[c][r].x = brickX; bricks[c][r].y = brickY; ctx.beginPath(); ctx.rect(brickX, brickY, brickWidth, brickHeight); ctx.fillStyle = '#0095DD'; ctx.fill(); ctx.closePath(); } }
}
// Draws a ball.
function drawBall() { ctx.beginPath(); ctx.arc(x, y, ballRadius, 0, Math.PI * 2); ctx.fillStyle = '#0095DD'; ctx.fill(); ctx.closePath();
}
// Draws a paddle.
function drawPaddle() { ctx.beginPath(); ctx.rect(paddleX, canvas.height - paddleHeight, paddleWidth, paddleHeight); ctx.fillStyle = '#0095DD'; ctx.fill(); ctx.closePath();
}
// Add event handlers.
document.addEventListener('keydown', keyDownHandler, false);
document.addEventListener('keyup', keyUpHandler, false);
function keyDownHandler (e) { if (e.keyCode == 39) { rightPressed = true; } else if (e.keyCode == 37) { leftPressed = true; }
}
function keyUpHandler(e) { if (e.keyCode == 39) { rightPressed = false; } else if (e.keyCode == 37) { leftPressed = false; }
}
// Update function.
function draw() { // Clear canvas. ctx.clearRect(0, 0, canvas.width, canvas.height); // Draw ball. drawBall(); // Draw bricks. drawBricks(); // Draw player. drawPaddle(); // Change direction if ball hits left/right wall. if (x + dx > canvas.width - ballRadius || x + dx < ballRadius) { dx = -dx; } // Change direction if ball hits top wall. if (y + dy < ballRadius) { dy = -dy; } else if (y + dy > canvas.height - ballRadius) { if (x > paddleX && x < paddleX + paddleWidth) { dy = -dy; } else { document.location.reload(); } } if (rightPressed) { paddleX += playerSpeed; } else if (leftPressed) { paddleX -= playerSpeed; } // Change position of the ball. x += dx; y += dy;
}
// Keep drawing.
setInterval(draw, 10);
// Rectangle.
// ctx.beginPath();
// ctx.rect(20, 40, 50, 50);
// ctx.fillStyle = '#FF0000';
// ctx.fill();
// ctx.closePath();
// Stroke rectangle.
// ctx.beginPath();
// ctx.rect(160, 10, 100, 40);
// ctx.strokeStyle = 'rgba(0, 0, 255, 0.5)';
// ctx.stroke();
// ctx.closePath();
Developer | Quincy Soeliman |
Username | quincysoeliman |
Uploaded | July 22, 2022 |
Rating | 3 |
Size | 2,576 Kb |
Views | 32,384 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
CSS Jenga Loading Animation | 2,932 Kb |
Car Animation | 2,238 Kb |
Flipping cards | 2,375 Kb |
Drawing board | 1,985 Kb |
VueJS Multi Select | 1,772 Kb |
VueJS Task | 1,699 Kb |
A Pen by Quincy Soeliman | 1,279 Kb |
Counter | 2,601 Kb |
VueJS Names | 1,608 Kb |
CSS Rocket Ship | 3,714 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Animated Vertical CSS3 Menu Black | MaCeLMp4 | 2,750 Kb |
Haml Calendar | Katydecorah | 5,643 Kb |
A Pen by Jess | Jessamyne | 5,100 Kb |
Airbnb Homepage | SindhujaD | 2,480 Kb |
Resume | Rottingroom | 5,483 Kb |
Sassy Buttons | Elyseholladay | 2,299 Kb |
Colorful Sliders | Chanrith | 1,246 Kb |
Wikipedia viewer | Chpecson | 2,865 Kb |
Background Images | Jooonebug | 2,100 Kb |
Awesome | Samarthpd | 2,901 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!