Quick Help Needed: Timed Title?

What do i need to change below so that the title screen is timed, instead of requesting the player to press a button? looking for like 3 secs before the game starts on its own

I currently have:

switch (gameProgress)
{
case GAME_INTRO:
arduboy.drawBitmap(0, 0, titlescreen, 128, 64, WHITE);
arduboy.setCursor(18, 56);
arduboy.print(“Press Any Button”);
if (arduboy.justPressed(A_BUTTON)) gameProgress = GAME;
else if (arduboy.justPressed(B_BUTTON)) gameProgress = GAME;
break;

case GAME:
//game
break;

You could just add a delay.

Replace

arduboy.setCursor(18, 56);
arduboy.print("Press Any Button");
if (arduboy.justPressed(A_BUTTON)) gameProgress = GAME;
else if (arduboy.justPressed(B_BUTTON)) gameProgress = GAME;

with

arduboy.display();
arduboy.delayShort(3000);
gameProgress = GAME;

Where can I fit my title graphic in there?

If you mean the titlescreen bitmap, where you have it now

case GAME_INTRO:
  arduboy.drawBitmap(0, 0, titlescreen, 128, 64, WHITE);
  arduboy.display();
  arduboy.delayShort(3000);
  gameProgress = GAME;
  break;
1 Like

Perfect, thanks so much!

This means Nothing can happen while waiting for these 3 seconds …

We do it like this:

case GAME_INTRO:
  globalCounter++;
  arduboy.drawBitmap(0, 0, titlescreen, 128, 64, WHITE);
  if ((globalCounter > 180) || (arduboy.justPressed(A_BUTTON | B_Button)))
  {
    gameProgress = GAME;
    globalCounter =0;
  }
  break;

This way you can wait 3 seconds OR press a button (and also do other stuff like blinking text or a led)

3 Likes

This works too, I appreciate all the help!

1 Like