# Hiding Splash Text after set amount of time

**URL:** https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104
**Category:** Help
**Tags:** extension
**Created:** [April 1, 2025, 6:30pm UTC](https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104 "2025-04-01T18:30:31Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Cory](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@Cory](https://forum.makecode.com/u/Cory)
#### Post date: [April 1, 2025, 6:30pm UTC](https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104/1 "2025-04-01T18:30:31Z")

</div>

I am currently updating my game to use the computer cursor via the Browser-Events extension. I have a splash text appear upon clicking on a sprite. I am wondering how I can hide this text after a set amount of time. Ex. Cursor clicks on sprite, splash text appears, wait 3 seconds, splash text hides.

---

<div class="post-metadata">

### Author: ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)
#### Post date: [April 1, 2025, 9:58pm UTC](https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104/2 "2025-04-01T21:58:48Z")

</div>

Ok, so basically if you are coding in blocks the short answer is “lol no, not unless I figure out how to make an extension that does it for you” and if you aren’t using blocks… well…

This seemed like a nice challenge, but it beat me 😭

@richard is there any way to make a simulated button push happen while the splash dialogue is running? It pushes the scene, and I can’t find a way to run a simulated button push while inside the scene function! I tried adding a scene push handler, but it doesn’t seem to be working, and I can’t find another way to either make the function think that the A button is pressed or force the scene to close prematurely. I’ve sunk more time than I’d like to admit into this single question and at this point I need more resolution than just “it’s not possible… not for me at least” 😭

---

<div class="post-metadata">

### Author: ![CodeOnTheCob](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/codeonthecob/32/19306_2.png) [@CodeOnTheCob](https://forum.makecode.com/u/CodeOnTheCob)
#### Post date: [April 1, 2025, 10:29pm UTC](https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104/3 "2025-04-01T22:29:05Z")

</div>

tried fake button press

---

<div class="post-metadata">

### Author: ![Gl125371](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gl125371/32/29131_2.png) [@Gl125371](https://forum.makecode.com/u/Gl125371)
#### Post date: [April 1, 2025, 10:31pm UTC](https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104/4 "2025-04-01T22:31:43Z")

</div>

Use the timer extension.

---

<div class="post-metadata">

### Author: ![Danny\_Devention](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/danny_devention/32/30134_2.png) [@Danny\_Devention](https://forum.makecode.com/u/Danny_Devention)
#### Post date: [April 1, 2025, 10:33pm UTC](https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104/5 "2025-04-01T22:33:24Z")

</div>

That is a cool idea, although not many people do that because most of the time you can simply press a button for the splash to go away. Perhaps use something along the lines of a timer and on every game update? I’m not entirely sure. Does anyone know how to do this?

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [April 1, 2025, 10:53pm UTC](https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104/6 "2025-04-01T22:53:26Z")

</div>

yes, it’s possible.

makecode’s runtime has what’s called an “event bus” for handling hardware-generated events like button presses. every event consists of two numbers: an event id and an event value. for button presses, the event id is either the id for the `ControllerButtonEvent.Pressed`, `ControllerButtonEvent.Released`, or `ControllerButtonEvent.Repeat` events. the event value is an id number that corresponds to the actual button being pressed. for example, the “Left” button is 1, the “Up” button is 2, etc. All of the buttons (including the ones for players 2-4) have their own unique id numbers. The id number 0 is a wildcard and corresponds to _any_ button being pressed/released/repeated.

so, to simulate a button press, all you need to do is raise an event on the event bus. to do that, you can use the `control.raiseEvent` API like so:

```ts
control.raiseEvent(ControllerButtonEvent.Pressed, controller.A.id);

```

or at least that’s how it would normally work. the splash screen actually listens for a different event so that it doesn’t interfere with the button handlers that are registered by the user code. so instead of using `ControllerButtonEvent.Pressed`, we can use the event id `INTERNAL_KEY_DOWN` instead:

```ts
control.raiseEvent(INTERNAL_KEY_DOWN, controller.A.id);

```

and here is an example project that demonstrates this:

> **[raise-event-example](https://arcade.makecode.com/95665-20449-37141-22791)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

### Author: ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)
#### Post date: [April 1, 2025, 11:13pm UTC](https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104/7 "2025-04-01T23:13:24Z")

</div>

OHHHHH I guess I just had it in my head that things running in parallel would be tied to the scene, so I didn’t even try just putting a parallel function outside of all the other stuff!

 ![Image 4-1-25 at 7.00 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/9/9/99b7be0b1efa16b2761dc78f74c9b7606648a830.jpeg)  
lol you can see I tried it, just not correctly!  
Side note, why isn’t that code in the screenshot running? I’ve tried adding stuff to that ScenePuchHandler and nothing is happening!

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [April 1, 2025, 11:18pm UTC](https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104/8 "2025-04-01T23:18:55Z")

</div>

i expect the bug is something to do with when the handler is being registered or when you’re setting the `splashActive` variable. the scene is pushed immediately when `game.splash` is called, so you need to call `addScenePushHandler` and set `splashActive` to true before `game.splash` is called.

for example:

> **[scene-push](https://arcade.makecode.com/87611-72390-73601-07221)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

also, i wouldn’t use `game.addScenePushHandler` for this! that API is more for extensions that need to maintain state for different scenes.

---

<div class="post-metadata">

### Author: ![Josef](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/josef/32/12457_2.png) [@Josef](https://forum.makecode.com/u/Josef)
#### Post date: [April 7, 2025, 2:57am UTC](https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104/9 "2025-04-07T02:57:37Z")

</div>

Well don’t use splash text lol. Do a background sprite then fancy text.

---

<div class="post-metadata">

### Author: ![Cory](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@Cory](https://forum.makecode.com/u/Cory)
#### Post date: [April 7, 2025, 3:00am UTC](https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104/10 "2025-04-07T03:00:56Z")

</div>

Thank you so much for this however after adding it into my project the JavaScript block needs to go on some kind of cooldown, and I can’t use it unless I wait 3ish seconds. [Project Link](https://arcade.makecode.com/S55922-31476-19065-82403)

---

<div class="post-metadata">

### Author: ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)
#### Post date: [April 10, 2025, 2:47am UTC](https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104/11 "2025-04-10T02:47:16Z")

</div>

Like, dragging the block in the simulator? Or using it in your game? If you send a “button pressed” event but forget the “button unpressed” event, the game thinks the button is pressed and won’t send more events unless you add a “button unpressed” event after.

---

<div class="post-metadata">

### Author: ![Cory](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@Cory](https://forum.makecode.com/u/Cory)
#### Post date: [April 11, 2025, 2:25am UTC](https://forum.makecode.com/t/hiding-splash-text-after-set-amount-of-time/35104/12 "2025-04-11T02:25:56Z")

</div>

Thanks for this. I figured it out and now it works as it should. If your wondering how I fixed it, I imagine you aren’t, I could put it in another comment. Thanks again for you and richard’s help!
