From 22384d28aacb3a69c25377826f0dda267165f001 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Sat, 17 Feb 2024 19:48:16 -0500 Subject: [PATCH] [pongwars] initial random angled speed --- pongwars/index.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pongwars/index.html b/pongwars/index.html index ee48c99..5e06464 100644 --- a/pongwars/index.html +++ b/pongwars/index.html @@ -231,8 +231,9 @@ } for (let i = 0; i < teams.length; i++) { - teams[i].dx = 5 * randInt(-1, 1); - teams[i].dy = 5; + const angle = randomNum(0, 2 * Math.PI); + teams[i].dx = 5 * Math.cos(angle); + teams[i].dy = 5 * Math.sin(angle); } }