Can't figure out why my code isn't working, could someone more experienced look over it? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can't figure out why my code isn't working, could someone more experienced look over it?

I have tried to debug this for a while with no avail. The invaders (red boxes) should be spawning at -100 (top of my screen) but are instead spawning at a specific location that changes with each update. Fairly sure the bug is within invader updates, (line 86 downwards). Thanks :) https://code.sololearn.com/WnV1LnSJ7ZGB/?ref=app

13th Jul 2020, 11:48 AM
Will
1 Answer
+ 3
It had something to do with positions ,I changed it to absolute for .invader div and works fine now, I do understand that relative means dependent on current container position ,and absolute is independent of that container position but you were simply appending ivClone to body element so anything relative to it should start from the -100 position but instead it was starting with .invader div ,maybe someone else can further explain about it
13th Jul 2020, 12:51 PM
Abhay
Abhay - avatar