0
Not the results I wanted [solved]
Hey guys, in this code I wanted to make a square move with setInterval but the square won’t move I hope someone could find the prob https://code.sololearn.com/WZKhfClm85iA/?ref=app
8 Respuestas
+ 2
Ah, I didn't realise you already had it there. All you need to do is remove the brackets/parentheses.
setInterval(update, 20);
NOT
setInterval(update(), 20);
+ 1
James now I feel like an idiot🤦♂️😂
+ 1
Yes, it seems I have to finish practicing at night.☺
+ 1
saif Get used to tiny bugs like this, if you want a career in coding!! 😁
0
You need to activate the "update ()" function, for example by setting the button:
<button onclick="update()">right</button>
0
Put something like this at the end of your script. The duration parameter is in milliseconds.
setInterval(update, 100);
0
i actually have the same one in the draw function
0
James why should i , i mean its right there in the draw function which is loaded right when the program runs, that and i tried it and no difference in the results is seen