From f09c1e963b79a2234180529857da6b4d18f7fb5c Mon Sep 17 00:00:00 2001 From: Kara Rondinelli Date: Thu, 21 Mar 2024 15:15:19 -0400 Subject: [PATCH] moving circle wooo --- week-09/event2/index.html | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/week-09/event2/index.html b/week-09/event2/index.html index 91dabfa..d10f721 100644 --- a/week-09/event2/index.html +++ b/week-09/event2/index.html @@ -49,9 +49,26 @@ drawCircle(x, y, size); - // Add your code here + window.addEventListener("keydown", e => { + switch (e.key) { + case "w": + y -= 10; + break; + case "a": + x -= 10; + break; + case "s": + y += 10; + break; + case "d": + x += 10; + break; + } + + drawCircle(x, y, size); + }); - - + +