Adding features to our bouncing ball demo

Hi guys,

I’m struggling to understand the bouncing balls assessment. I don’t understand what I need to do in response to the passage below.

image

Also, my balls have shrunk and I don’t know why (not something I thought I’d write in this forum).

I’ve provided a link to my code below, any help would be much appreciated.

Codepen

Regards,

Jared

Hi @Jared_Cave!

This is a really difficult assessment, and looking at your code, you are definitely getting there.

The first thing I did was to comment out the line firstCircle.setControls();, as the console was complaining that setControls is not a function. So there must be something wrong with your EvilCircle constructor.

You should also move the creation of the EvilCircle instance out of the loop - you don’t want one EvilCircle for every ball created.

Also, I’m sorry to see that your balls have shrunk. I was going to suggest some ointment, but instead I investigated your code. if you run balls[0].size, it returns true, whereas it should return a number. I wonder how that has happened?

Have another look, and see if you can figure this out. Also, feel free to have a peep at our version, if you want to get some more clues: https://github.com/mdn/learning-area/blob/master/javascript/oojs/assessment/main.js

Hi Chris,

Thanks for the pointers. I realised I skipped the JSON assessment by mistake so I’m going to complete that first then come back to this tomorrow/Saturday. I’ll let you know how is goes.

Regards,

Jared