Movement in Random Intervals | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

Movement in Random Intervals

How can I make this box move in a random direction in random intervals without clicking it? https://code.sololearn.com/WzO620NuNO3U/?ref=app

8th Sep 2020, 7:15 AM
Unrealistic Engineer
Unrealistic Engineer - avatar
2 Réponses
+ 1
Using window.onload event handler and calling a function when window uploads ,
8th Sep 2020, 7:45 AM
Abhay
Abhay - avatar
+ 1
create an interval or timeout wuth random wait time to call moveit here's one way to do it. function rmove(){ moveit(); setTimeout(rmove, parseInt(Math.random() * 3000)); }
8th Sep 2020, 8:09 AM
Rei
Rei - avatar