# Why does this happen?

**URL:** <https://forum.makecode.com/t/why-does-this-happen/6798>\
**Category:** Help\
**Created:** [March 16, 2021, 4:04pm UTC](https://forum.makecode.com/t/why-does-this-happen/6798 "2021-03-16T16:04:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Agent\_14](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/agent_14/32/17567_2.png) [@Agent\_14](https://forum.makecode.com/u/Agent_14)\
**Post date:** [March 16, 2021, 4:04pm UTC](https://forum.makecode.com/t/why-does-this-happen/6798/1 "2021-03-16T16:04:18Z")

</div>

> **[Fog and Lighting Effects](https://arcade.makecode.com/24053-63057-68149-20782)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Press up to see the error while in debug mode.

---

<div class="post-metadata">

**Author:** ![eanders](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/eanders/32/3134_2.png) [@eanders](https://forum.makecode.com/u/eanders)\
**Post date:** [March 16, 2021, 4:30pm UTC](https://forum.makecode.com/t/why-does-this-happen/6798/2 "2021-03-16T16:30:46Z")

</div>

Looks like the fog sprite is being accessed before assignment, here:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/f/ff1dc2ebf08d28f274d84d23109bcf8b75665a5d.png)

Error message is not helpful in this case. I’ll file a GitHub issue to improve it.
