+ 7

Car game

I had this idea to make a car game. As simple as to where you click a button it will move the cars to my position. To make one car go faster and one car go slower I made it so there was a transition. I’m not sure if it was the best idea. I’m on mobile right now and it’s giving me a syntax error and I’m not seeing where it is. https://code.sololearn.com/W524bj99j0Ak/?ref=app

17th Jul 2022, 3:55 PM
Junior
Junior - avatar
15 Answers
+ 2
A JavaScript function is defined with the function keyword, followed by a name, followed by parentheses (). function name() { // code to be executed }
17th Jul 2022, 4:57 PM
Chris Coder
Chris Coder - avatar
17th Jul 2022, 8:51 PM
Chris Coder
Chris Coder - avatar
+ 1
Have a look at the CSS animation properties https://www.w3schools.com/css/css3_animations.asp
17th Jul 2022, 9:33 PM
Chris Coder
Chris Coder - avatar
+ 1
https://code.sololearn.com/Wj7ipJv3NMm2/?ref=app I want it to be kind of how sololearn did it. except the values random
17th Jul 2022, 9:48 PM
Junior
Junior - avatar
+ 1


18th Jul 2022, 11:23 AM
soman kumar
soman kumar - avatar
0
Thanks! Except now its giving me an error about my position.left = “50px”;
17th Jul 2022, 5:06 PM
Junior
Junior - avatar
0
Why do you keep renaming your variables?
17th Jul 2022, 7:56 PM
Chris Coder
Chris Coder - avatar
0
What do you mean?
17th Jul 2022, 8:01 PM
Junior
Junior - avatar
0
Ahh i see
17th Jul 2022, 8:52 PM
Junior
Junior - avatar
0
Okay so i fixed that. Only problem really is why my transition is not working.
17th Jul 2022, 9:05 PM
Junior
Junior - avatar
0
What do you want the transition to do?
17th Jul 2022, 9:10 PM
Chris Coder
Chris Coder - avatar
0
How do i make the boxes have speed. I waa thinking by adding transition they would move across.
17th Jul 2022, 9:12 PM
Junior
Junior - avatar
0
randRed + "s"; is not a proper transition value
17th Jul 2022, 9:14 PM
Chris Coder
Chris Coder - avatar
0
Okay, sorry that was a bad mistake. Anyhows how do i make the “cars” have speed so they dpnt just instantly go to they yellow line it actually yakes some time
17th Jul 2022, 9:16 PM
Junior
Junior - avatar
19th Jul 2022, 8:53 AM
Hridoy Howlader
Hridoy Howlader - avatar