# Smudging sprites in game

**URL:** <https://forum.code.org/t/smudging-sprites-in-game/34745>\
**Category:** Coding and Debugging Help\
**Tags:** csd-unit-3\
**Created:** [May 19, 2021, 4:41pm UTC](https://forum.code.org/t/smudging-sprites-in-game/34745 "2021-05-19T16:41:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![GordonBrune](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/gordonbrune/32/4752_2.png) [@GordonBrune](https://forum.code.org/u/GordonBrune)\
**Post date:** [May 19, 2021, 4:41pm UTC](https://forum.code.org/t/smudging-sprites-in-game/34745/1 "2021-05-19T16:41:44Z")

</div>

Why are the sprites in this student’s project “smudging”? We remember this happening with the shaking blender activity and we just put a background at the top of the draw loop to cover up the old version of the sprite but can’t figure out what the issue is here.

> **[Code.org](https://studio.code.org/users/sign_in)**
>
> Anyone can learn computer science. Make games, apps and art with code.

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:** [May 19, 2021, 7:29pm UTC](https://forum.code.org/t/smudging-sprites-in-game/34745/2 "2021-05-19T19:29:29Z")

</div>

@GordonBrune

The only place the navy background is called is in the intro function. It runs once at the beginning and never again, so it isn’t drawn to cover up the sprites as their position changes. That’s why the “smudging” occurs because a new background needs to be drawn each time through the draw loop to create the animation effect.

Mike

---

<div class="post-metadata">

**Author:** ![GordonBrune](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/gordonbrune/32/4752_2.png) [@GordonBrune](https://forum.code.org/u/GordonBrune)\
**Post date:** [May 19, 2021, 11:50pm UTC](https://forum.code.org/t/smudging-sprites-in-game/34745/3 "2021-05-19T23:50:25Z")

</div>

Thanks once again, Mike.

---

<div class="post-metadata">

**Author:** ![ben\_kuehl](https://avatars.discourse-cdn.com/v4/letter/b/779978/32.png) [@ben\_kuehl](https://forum.code.org/u/ben_kuehl)\
**Post date:** [May 28, 2021, 4:36pm UTC](https://forum.code.org/t/smudging-sprites-in-game/34745/4 "2021-05-28T16:36:30Z")

</div>

Hello

I am having similar problems with smudging sprites for various students on lesson 7’s project actually. Any help is appreciated or tips to ensure the smudging doesn’t happen.

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

Is the fill command part of the problem? Just not sure how to fix that when it happens for students.

---

<div class="post-metadata">

**Author:** ![melynn](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/melynn/32/4925_2.png) [@melynn](https://forum.code.org/u/melynn)\
**Post date:** [May 28, 2021, 6:44pm UTC](https://forum.code.org/t/smudging-sprites-in-game/34745/5 "2021-05-28T18:44:17Z")

</div>

Hi @ben_kuehl,

I believe you are referring to the smile sprite appearing randomly but not disappearing in the animation? If yes, this is happening because for the smile sprite, the var createsSprite block is inside the function draw instead of outside it like the other sprites. This causes the sprite to be recreated in a random spot each time through the loop. The var createSprite AND the setAnimation for the sprite should be outside the function draw but keep the smile.rotation in the function draw. When you do this, the sprite should animate like the others.

~Michelle
