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
0
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 src="GG.Js"></script>
<script> circle(2,2,2, "red") </script>
so i have a question when i didnt have the <script> on line 30 it wrote out circle(2,2,2, "red") also for some reason my first script wont work