Help with simple titlescreen code


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.

2 Likes

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. :smiley:

3 Likes

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


Thanks again!

1 Like

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