0

Why my raindrops keep destroying theirself while they haven't go behind the screen ?

All is in the question, please help <3 https://code.sololearn.com/W3xm1fbZ8tOi/?ref=app

6th Nov 2018, 3:03 PM
Thomas Teixeira
Thomas Teixeira - avatar
5 Answers
+ 6
I think you need to tell the diffrent sized rain drops the correct coordinates of when it needs to destory itself
6th Nov 2018, 3:15 PM
D_Stark
D_Stark - avatar
+ 3
Actually, you made another change that's important: tz controls the order in which drops hit the bottom (you changed it so that z is always 1, so now order never changes). Just for visualization, add this to [HTML] above the canvas tag: <div id="dropcount"></div> [JS] tab // add this 39: document.getElementById("dropcount").innerHTML=$raindrops.length; // Then put tz back (instead of 1) 47: $raindrops.push(new RainDrop(tx, ty, 1, $raindrops.length)); Watch the count go up, and then crash back towards 0. Taking CalviŐ˛ and D_Stark's comments, ask yourself: Why does it matter, the order in which drops hit the bottom?
6th Nov 2018, 5:42 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
$raindrops.splice(self.i, 1);
6th Nov 2018, 3:14 PM
CalviŐ˛
CalviŐ˛ - avatar
0
I think it come from my for loop, because I remove it and it stop bugging :/
6th Nov 2018, 5:22 PM
Thomas Teixeira
Thomas Teixeira - avatar
0
Thank you all, I follow your advices however I just put the limit to height * 1/self.z
6th Nov 2018, 7:03 PM
Thomas Teixeira
Thomas Teixeira - avatar