+ 1

Box Game

So why is it not adding a point for whenever you touch a box? https://www.sololearn.com/compiler-playground/WyXqIAu1sBa1/

24th Sep 2022, 6:42 PM
Junior
Junior - avatar
7 Antworten
+ 2
The box…random… variables are local and cannot be see in another parts or functions in your code. A solution shows following changed code: https://code.sololearn.com/WJdTq9l1NlQ2/?ref=app
24th Sep 2022, 9:46 PM
JaScript
JaScript - avatar
+ 3
Any feedback from you Your Mom ?
28th Sep 2022, 7:35 PM
JaScript
JaScript - avatar
+ 2
Chris Coder Thank you for the information. It works for me either way. Now I have modified it. Should work everywhere.
26th Sep 2022, 2:08 PM
JaScript
JaScript - avatar
+ 1
JaScript do u know why they arent moving whenever u clikc them
25th Sep 2022, 5:01 PM
Junior
Junior - avatar
+ 1
JaScript It works in a web browser but it is not working via codeplayground.
25th Sep 2022, 9:32 PM
Chris Coder
Chris Coder - avatar
+ 1
@JaScript so u see line 119, and it says box1.style.position = "relative"; box1.style.top = box1RandomHeight; box1.style.left = box1RandomWidth; i want it so everytime u click a box it randomizes its position. like how whenever u click New Game it randomizes the boxs position. u get what i mean?
26th Sep 2022, 11:27 PM
Junior
Junior - avatar
0
Your Mom I have already answered your question above and in my corrected code they move. If the answer is not sufficient then it is needed from you a precise question and description, what do you want to achieve, how and when should something move?
25th Sep 2022, 7:33 PM
JaScript
JaScript - avatar