# Help with simple titlescreen code

**URL:** <https://forum.makecode.com/t/help-with-simple-titlescreen-code/30818>\
**Category:** Help\
**Tags:** game\
**Created:** [September 24, 2024, 9:11pm UTC](https://forum.makecode.com/t/help-with-simple-titlescreen-code/30818 "2024-09-24T21:11:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Snail](https://avatars.discourse-cdn.com/v4/letter/s/5e9695/32.png) [@Snail](https://forum.makecode.com/u/Snail)\
**Post date:** [September 24, 2024, 9:11pm UTC](https://forum.makecode.com/t/help-with-simple-titlescreen-code/30818/1 "2024-09-24T21:11:43Z")

</div>

![Screenshot 2024-09-24 at 22.00.48](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/b/7/b71042507c6aea0af28f8c00b837a8b2fb5ec72d.png)  
I’ve been trying to bugfix this to make the inputs actually do something, but no luck. was hoping one of you would be able to help me.

---

<div class="post-metadata">

**Author:** ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)\
**Post date:** [September 24, 2024, 10:15pm UTC](https://forum.makecode.com/t/help-with-simple-titlescreen-code/30818/2 "2024-09-24T22:15:09Z")

</div>

Welcome, @Snail !

The player would have to push **A** or **B** exactly 1/2 second after the songs start to play. If not, then there’s nothing to do. If they’re even one millisecond late, your code will miss the button press.

MakeCode is event driven, so you have to think about your code a bit differently compared to other programming environments. You’re better off using a variable to keep track of “game state.” I do it frequently in my games. Then, based on the state the game is in, your buttons function differently.

Here’s an example. Press **A** to do stuff. 😃

> **[Game States](https://arcade.makecode.com/00487-09420-03731-58783)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Snail](https://avatars.discourse-cdn.com/v4/letter/s/5e9695/32.png) [@Snail](https://forum.makecode.com/u/Snail)\
**Post date:** [September 25, 2024, 4:36pm UTC](https://forum.makecode.com/t/help-with-simple-titlescreen-code/30818/3 "2024-09-25T16:36:04Z")

</div>

Thanks! I already decided to use functions but this answer really helps me understand why it doesn’t work instead of just how to fix it. Here’s my code now in case you were wondering

 ![Screenshot 2024-09-25 at 07.45.22](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/7/3/73bca6157798a86529f145deb6b942c4d96bcddd.png)  
Thanks again!

---

<div class="post-metadata">

**Author:** ![FN76](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/fn76/32/17431_2.png) [@FN76](https://forum.makecode.com/u/FN76)\
**Post date:** [September 25, 2024, 6:25pm UTC](https://forum.makecode.com/t/help-with-simple-titlescreen-code/30818/4 "2024-09-25T18:25:50Z")

</div>

Also, I think it would be cool if you added an attract mode demo in a later build of the game; makes it feel more complete
