Help wanted for Adding bouncing balls features - VV

Hey there,

disclaimer - STILL IN PROGRESS!

I was just curious as to why my program stopped working.

In the MDN doc, it says that “At this point, try reloading the code — it should work just the same as it did before, with our redesigned objects.” After I’ve redesigned the objects and added in the Shape class.

I haven’t done anything with the “Evil Circle” yet. The canvas is now black with no visible balls generating as before.

Live Site: https://assessment-version-bb-demo.glitch.me
Code: https://glitch.com/edit/#!/assessment-version-bb-demo
MDN: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Adding_bouncing_balls_features#create_a_shape_class

I’m going to keep this thread up as a progress update on the assessment.

Forgot to add the “r” in “constructor” lol. That’s why the balls weren’t showing up!

Okay, Just finished the assessment! I added two players and TRIED to add a score counter BUT the number is coming out as “undefined” and Im not sure why. I’ve defined “this.score = 0” on both EvilCircle and EvilCircle2 and added the count in the loop in the bottom of the file.

Any idea why they’d be coming out “undefined”?

Live Page: https://bb-demo-2-players.glitch.me

Code: https://glitch.com/edit/#!/bb-demo-2-players

MDN Section: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Adding_bouncing_balls_features#defining_evilcircle

Thanks for the help - been learning a lot!

Nice work @Vladlen_Vronsky

The code looks very good now. :+1:

To show both scores simultaneously you could add a second paragraph. Then you’ll give both a distinct class and use those as selectors for para and para2 in your JS. You’ll also need to use these classes in CSS to position one score above the other.

Another thing that could remove some duplication from the code would be to only have one EvilCircle class and put the differences into parameters (color, keys etc.)

Have a nice day,
Michael

1 Like

Awesome! Thank you for checking it out @mikoMK I really appreciate this.

I’ll take another look at it this week and resolve the issue!

1 Like