r/learnjavascript • u/Physical-Bid6508 • Feb 28 '26
how to add player inputs?
so i wonder how you add player inputs cause i want to add a moving car to my program
0
Upvotes
r/learnjavascript • u/Physical-Bid6508 • Feb 28 '26
so i wonder how you add player inputs cause i want to add a moving car to my program
View all comments
Show parent comment
1
u/Physical-Bid6508 Mar 02 '26
<script src="https://koda.nu/simple.js"> let randomnum = 0 function triangle(x, y, diameter, height, colour){ let int = 0 while (int != abs(ceil(diameter)-1)) { line(x+int, y, x+diameter/2, y-height, 2, colour) int = (int + 1) } } function spikes(){ clearScreen() let repeat = 0 rectangle(70, 210, 120, 40, "blue"); rectangle(100, 210, 60, -20, "blue"); circle(100, 250, 20, "red"); circle(160, 250, 20, "red"); requestAnimationFrame(spikes) } window.addEventListener("keydown", spikes) </script>
<script type= "text/javascript" src="Yo_mama.Js"> circle(2,2,2, "red") </script>
like this? i have no idea how to create a different tag and i am guessing you want me to create two different scripts one for all those html and head and body and buttons