+ 1

lf I make an animation of div elements that cancel each other when they touch how can I do that without using many if statements

31st Dec 2019, 11:28 AM
boolean
boolean - avatar
11 Réponses
+ 4
Well that code is too long, so I'll just give you an idea: Make a function that detects collision You can easily program it, or check for some online tutorials. Make a function that keeps track of you elements position. Make a function that detects the edges of an element. Finally, find a creative way to connect all of the three functions mentioned above :) Not sure if this is the best solution, but that's how I would do it..
31st Dec 2019, 2:08 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
Can you post your code here ?
31st Dec 2019, 11:32 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
I don't code on SoloLearn, is it okay if I make a web version of it ? You can then copy-paste the files on your computer. Also, I need to see an attempt from you first.
31st Dec 2019, 3:05 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
boolean I want to see a small code from you..
31st Dec 2019, 6:25 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 2
Okay
31st Dec 2019, 8:28 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
31st Dec 2019, 2:03 PM
boolean
boolean - avatar
+ 1
It's ok you can make a web version of it
31st Dec 2019, 6:10 PM
boolean
boolean - avatar
+ 1
Oryt I've got an idea that wont waste time I will just take my code clear the if statement and some other elements from the code
31st Dec 2019, 8:18 PM
boolean
boolean - avatar
31st Dec 2019, 9:01 PM
boolean
boolean - avatar
+ 1
Happy New year
1st Jan 2020, 10:43 PM
Monse
Monse - avatar
0
May you do me just a small code example so that I would understand better
31st Dec 2019, 2:58 PM
boolean
boolean - avatar