# Sprite not appearing in front of background

**URL:** <https://forum.code.org/t/sprite-not-appearing-in-front-of-background/27231>\
**Category:** CS Discoveries\
**Created:** [June 6, 2019, 7:14pm UTC](https://forum.code.org/t/sprite-not-appearing-in-front-of-background/27231 "2019-06-06T19:14:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chadwicko](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@chadwicko](https://forum.code.org/u/chadwicko)\
**Post date:** [June 6, 2019, 7:14pm UTC](https://forum.code.org/t/sprite-not-appearing-in-front-of-background/27231/1 "2019-06-06T19:14:50Z")

</div>

For some reason one of my students has a sprite called “pellet” appearing behind the background. We have looked at it through several lenses and cannot find the reason.

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

---

<div class="post-metadata">

**Author:** ![karenma](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/karenma/32/4924_2.png) [@karenma](https://forum.code.org/u/karenma)\
**Post date:** [June 7, 2019, 5:09pm UTC](https://forum.code.org/t/sprite-not-appearing-in-front-of-background/27231/2 "2019-06-07T17:09:23Z")

</div>

Hi Chad,  
Had to crop the sprites in the Animation tab, and put the background at the very bottom of the draw loop.

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

---

<div class="post-metadata">

**Author:** ![chadwicko](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@chadwicko](https://forum.code.org/u/chadwicko)\
**Post date:** [June 10, 2019, 7:03pm UTC](https://forum.code.org/t/sprite-not-appearing-in-front-of-background/27231/3 "2019-06-10T19:03:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kevinsukhoo](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/kevinsukhoo/32/3617_2.png) [@kevinsukhoo](https://forum.code.org/u/kevinsukhoo)\
**Post date:** [June 12, 2019, 2:06am UTC](https://forum.code.org/t/sprite-not-appearing-in-front-of-background/27231/4 "2019-06-12T02:06:19Z")

</div>

Hi @chadwicko!

Just wanted to check in to see if your student was able to figure this out?  
I didn’t see ‘pellet’ appear in the last link you shared, but I might be doing something wrong.

thanks!  
-kevin

---

<div class="post-metadata">

**Author:** ![chadwicko](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@chadwicko](https://forum.code.org/u/chadwicko)\
**Post date:** [June 12, 2019, 6:48pm UTC](https://forum.code.org/t/sprite-not-appearing-in-front-of-background/27231/5 "2019-06-12T18:48:19Z")

</div>

Still not working, sir.

---

<div class="post-metadata">

**Author:** ![bradleywellsashley](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/bradleywellsashley/32/522_2.png) [@bradleywellsashley](https://forum.code.org/u/bradleywellsashley)\
**Post date:** [June 16, 2019, 11:44pm UTC](https://forum.code.org/t/sprite-not-appearing-in-front-of-background/27231/6 "2019-06-16T23:44:19Z")

</div>

Oliver,

Finally figured out what the issue is. The Pellet sprite is actually the size of the sprite, not the size of the pellet. So with a starting point of (350, 41) the pellet is way above the canvas. If you change the starting location of the pellet to (350, 350) you’ll see the pellet appear.

Note: I also changed the if condition for the pellet to move by using the down arrow - the `mouseOver` works too, but the down arrow was easier to control and debug.

Hope that helps!  
Brad

---

<div class="post-metadata">

**Author:** ![chadwicko](https://avatars.discourse-cdn.com/v4/letter/c/b782af/32.png) [@chadwicko](https://forum.code.org/u/chadwicko)\
**Post date:** [April 29, 2021, 6:50pm UTC](https://forum.code.org/t/sprite-not-appearing-in-front-of-background/27231/7 "2021-04-29T18:50:56Z")

</div>

of course, it is something easy that we missed. Thank you.
