const canvas = document.getElementById("universeCanvas");
const ctx = canvas.getContext("2d");
// Generate random particles in the universe
let particles = [];
for (let i = 0; i < 3600; i++) {
let x = Math.floor(Math.random() * 360);
let y = Math.floor(Math.random() * 360);
particles.push({ x, y });
}
// Update function to move particles
function updateParticles() {
particles.forEach(particle => {
particle.x += Math.random() - 0.5;
particle.y += Math.random() - 0.5;
// Wrap around the canvas edges
if (particle.x < 0) {
particle.x = 360;
}
if (particle.x > 360) {
particle.x = 0;
}
if (particle.y < 0) {
particle.y = 360;
}
if (particle.y > 360) {
particle.y = 0;
}
});
}
// Render function to draw particles on canvas
function renderParticles() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
particles.forEach(particle => {
ctx.fillRect(particle.x, particle.y, 1, 1);
});
}
// Main game loop
function gameLoop() {
updateParticles();
renderParticles();
requestAnimationFrame(gameLoop);
}
gameLoop();
*This prompt didn't get me into the game this time. Plz try to generate it a few times.