# Final project lesson 27

**URL:** <https://forum.code.org/t/final-project-lesson-27/35540>\
**Category:** Unit and Lesson Discussion\
**Tags:** csd-unit-3\
**Created:** [December 6, 2021, 2:30pm UTC](https://forum.code.org/t/final-project-lesson-27/35540 "2021-12-06T14:30:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmcgraw](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@cmcgraw](https://forum.code.org/u/cmcgraw)\
**Post date:** [December 6, 2021, 2:30pm UTC](https://forum.code.org/t/final-project-lesson-27/35540/1 "2021-12-06T14:30:18Z")

</div>

I have a student that is trying to duplicate the snake game. If the snake touches one thing, then the snake gets longer (or the part attaches to it). How can this be done? I’m totally drawing a blank to figure this out.  
Thanks in advance.

---

<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:** [December 6, 2021, 7:38pm UTC](https://forum.code.org/t/final-project-lesson-27/35540/2 "2021-12-06T19:38:40Z")

</div>

@cmcgraw,

Sometimes, the most simple looking projects are actually pretty complex. The problem isn’t just getting the snake to grow by one body length, but how to get its length to continue to grow each time it eats something.

This involves keeping track of its size and then visually changing its appearance to match that.

That gets pretty complex pretty quickly (even though it is doable).

If you Google “[code.org](http://code.org) snake game” you will find a number of different projects that others have made using Game Lab, and looking at the code will show you how the game was created, however, that doesn’t mean it is easy to understand and code yourself (for a beginner).

For a beginning student, I might suggest something a little more simple to solve this problem. Rather than making it like the real snake game where the snake can grow to an indefinitely long length, they might consider creating “animations” of length 1, 2, 3 and 4 (or maybe a few more … depending). Then, when the snake comes into contact with the “food”, they could switch “animations” (costumes) to a larger version of themself.

Then, the length could be tracked using a simple variable and if snake1 eats the food, it becomes snake 2, snake 2 could be come snake3, etc.

If your student is more advanced, maybe suggest they google “[code.org](http://code.org) snake game” and they can look at the code and see how it was done to help create their own version.

That’s probably how I would address it with one of my students…

Mike

---

<div class="post-metadata">

**Author:** ![cmcgraw](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@cmcgraw](https://forum.code.org/u/cmcgraw)\
**Post date:** [December 6, 2021, 8:12pm UTC](https://forum.code.org/t/final-project-lesson-27/35540/3 "2021-12-06T20:12:05Z")

</div>

Ok  
Thank you very much. That helps a lot. I will definitely suggest both to her and see what she wants to try to do. I like the setting a new animation idea.
