26 AnswersNew Answer
I cant tell if this is working or not. what i mena is are my clicks working? I have a function for the same button but theyre are for different uses. Anyone know of anythinng is wrong with the code or am i paranoid i cant click my own button? https://code.sololearn.com/W2FE8G5Sh5MZ/?ref=app
6/2/2022 8:57:47 PMYour Mom
26 AnswersNew Answer
You put the setInterval line inside the definition of the move function. Move it outside of it and remove the extra call to move that comes directly after and it works.
Isn't it by design that you can't click the button? The moment the mouse cursor moves over the button the button jumps away, so of course you can't click it. However, on mobile, sometimes the button stops moving around and when that happens you can click it and the counter works.
so should i add a transition to make it clickible?
It depends on what your goal is. But if you want people to be able to click the button it can't move away before they have the chance to click it.
Why don't you just use the click event instead of mouse over? You can attach multiple function to an element/ event
You could use click events for both. Just make sure that you add clicker() before move() to the button
In case you are trying to do a game of catching the button, shouldn't the moving be primarily independent of the user's response? Like the button changing its position at random intervals when the player doesn't catch it?
hmm could work…good idea i can do that
okay, so im trying to make the button move while you have to try to click it but its not moving https://code.sololearn.com/WZiF88n1IQ2I/?ref=app
It does move. But just once at the start.
ye so how do i make it move infinetly? I used setInterval abd used math.random but its not working
Use a loop?
like a while loop?
Okay, I used a while loop but now nothings working. very confusing https://code.sololearn.com/WZiF88n1IQ2I/?ref=app
uhh..k so can u show me what im doing wrong and what type of loop i should be using
ye heres the original code https://code.sololearn.com/W2FE8G5Sh5MZ/?ref=app and heres what im trying to do: https://code.sololearn.com/WZiF88n1IQ2I/?ref=app
The original code interacts differently in a web browser opposed to this app. Have you tried it on desktop? To see the differences?
ye ye but i wanted the button to move infinetly while u chase it. thats why i sdded a setInterval so it moves every second
Sololearn Inc.535 Mission Street, Suite 1591
Send us a message