# A game with led

**URL:** <https://forum.makecode.com/t/a-game-with-led/4075>\
**Category:** micro:bit\
**Created:** [October 25, 2020, 12:49pm UTC](https://forum.makecode.com/t/a-game-with-led/4075 "2020-10-25T12:49:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ymxdj0](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ymxdj0/32/1222_2.png) [@ymxdj0](https://forum.makecode.com/u/ymxdj0)\
**Post date:** [October 25, 2020, 12:49pm UTC](https://forum.makecode.com/t/a-game-with-led/4075/1 "2020-10-25T12:49:34Z")

</div>

> **[a game with led](https://makecode.microbit.org/27885-16355-93521-69700)**
>
> Made with ❤️ in Microsoft MakeCode for micro:bit.

  
was tired so i tried making a game with micro:bit  
if you have any tips comment

---

<div class="post-metadata">

**Author:** ![Pavlos-Efstathiou](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/pavlos-efstathiou/32/2868_2.png) [@Pavlos-Efstathiou](https://forum.makecode.com/u/Pavlos-Efstathiou)\
**Post date:** [December 28, 2020, 5:40pm UTC](https://forum.makecode.com/t/a-game-with-led/4075/2 "2020-12-28T17:40:11Z")

</div>

The game crashes when the A or B button is pressed because the sprite variable is null. Please assign a value to it before using it  
Output from Chrome’s console:

 ![BOgRbtO4bP](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/4/4b0b10118f24b5f1fe89f006ab4d3e10f3ab076c.jpeg)

---

<div class="post-metadata">

**Author:** ![ymxdj0](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ymxdj0/32/1222_2.png) [@ymxdj0](https://forum.makecode.com/u/ymxdj0)\
**Post date:** [December 29, 2020, 4:19am UTC](https://forum.makecode.com/t/a-game-with-led/4075/3 "2020-12-29T04:19:47Z")

</div>

I didn’t understand a thing but okay

---

<div class="post-metadata">

**Author:** ![Pavlos-Efstathiou](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/pavlos-efstathiou/32/2868_2.png) [@Pavlos-Efstathiou](https://forum.makecode.com/u/Pavlos-Efstathiou)\
**Post date:** [December 29, 2020, 3:28pm UTC](https://forum.makecode.com/t/a-game-with-led/4075/4 "2020-12-29T15:28:44Z")

</div>

Add this to the `on start` block: `set sprite to` and the value that you want to assign to it and is compatible with it’s type
