Unit 3 Lesson 7 Robot Face

I have offered to students that they remix their Robot Face and put it in a draw functions if they have included Random Number ranges for at least one of their variables. Why is this project not animating? I am stumped!

Hi, Koliner!

It works perfectly on my side. The circles are being drawn at random Y coordinates every time I hit RUN, as expected from the code.

Was that not what you were trying to achieve?

Thanks for this answer. I got it working (Animating by updating in the “draw loop” 30x/second) by putting the variables in the draw loop, since they are generating the random numbers. I suppose I should have students use the “declare variable up top, update it’s value in the draw loop” pattern if their variable value needs to change throughout the program.

1 Like

Yes, create above and update inside the draw loop is the best way to do it. If you create inside the draw loop, you are creating an infinite number of images which can cause processor issues and/or make it difficult to refer to the sprites if you want to update them later.

Mike

1 Like