# Unit 3 Lesson 7 Robot Face

**URL:** <https://forum.code.org/t/unit-3-lesson-7-robot-face/39858>\
**Category:** Coding and Debugging Help\
**Tags:** csd-unit3\
**Created:** [September 22, 2024, 4:40pm UTC](https://forum.code.org/t/unit-3-lesson-7-robot-face/39858 "2024-09-22T16:40:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![koliner](https://avatars.discourse-cdn.com/v4/letter/k/f04885/32.png) [@koliner](https://forum.code.org/u/koliner)\
**Post date:** [September 22, 2024, 4:40pm UTC](https://forum.code.org/t/unit-3-lesson-7-robot-face/39858/1 "2024-09-22T16:40:33Z")

</div>

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!

> **[Check out what I made](https://studio.code.org/projects/gamelab/d0c7f285G1I99fJ1bN85ujhbwiqTzzOk8_yXw5kT4qE)**
>
> I wrote the code myself with Code.org

---

<div class="post-metadata">

**Author:** ![parth.patel](https://avatars.discourse-cdn.com/v4/letter/p/90db22/32.png) [@parth.patel](https://forum.code.org/u/parth.patel)\
**Post date:** [September 23, 2024, 2:08pm UTC](https://forum.code.org/t/unit-3-lesson-7-robot-face/39858/2 "2024-09-23T14:08:19Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![koliner](https://avatars.discourse-cdn.com/v4/letter/k/f04885/32.png) [@koliner](https://forum.code.org/u/koliner)\
**Post date:** [September 23, 2024, 3:57pm UTC](https://forum.code.org/t/unit-3-lesson-7-robot-face/39858/3 "2024-09-23T15:57:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mwood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/mwood/32/4941_2.png) [@mwood](https://forum.code.org/u/mwood)\
**Post date:** [September 23, 2024, 5:21pm UTC](https://forum.code.org/t/unit-3-lesson-7-robot-face/39858/4 "2024-09-23T17:21:22Z")

</div>

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
