# How set a button to Pause the game?

**URL:** https://forum.makecode.com/t/how-set-a-button-to-pause-the-game/2381
**Category:** Arcade
**Created:** [June 11, 2020, 10:18am UTC](https://forum.makecode.com/t/how-set-a-button-to-pause-the-game/2381 "2020-06-11T10:18:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![adcoding](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/adcoding/32/27305_2.png) [@adcoding](https://forum.makecode.com/u/adcoding)
#### Post date: [June 11, 2020, 10:18am UTC](https://forum.makecode.com/t/how-set-a-button-to-pause-the-game/2381/1 "2020-06-11T10:18:19Z")

</div>

For example: press button B to pause the game until a I press another button to start it again…

---

<div class="post-metadata">

### Author: ![TakeTheL08](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/takethel08/32/7018_2.png) [@TakeTheL08](https://forum.makecode.com/u/TakeTheL08)
#### Post date: [June 11, 2020, 10:38am UTC](https://forum.makecode.com/t/how-set-a-button-to-pause-the-game/2381/2 "2020-06-11T10:38:39Z")

</div>

You use the menu button.  
No, I don’t know the keybind for it.

---

<div class="post-metadata">

### Author: ![adcoding](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/adcoding/32/27305_2.png) [@adcoding](https://forum.makecode.com/u/adcoding)
#### Post date: [June 11, 2020, 11:42am UTC](https://forum.makecode.com/t/how-set-a-button-to-pause-the-game/2381/3 "2020-06-11T11:42:00Z")

</div>

lol I didn’t notice the menu button…

---

<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: [June 11, 2020, 4:05pm UTC](https://forum.makecode.com/t/how-set-a-button-to-pause-the-game/2381/4 "2020-06-11T16:05:41Z")

</div>

To add to this:

If you’re in JavaScript, you can “pause” the game using scenes. There are two functions in the game namespace to help with it:

```typescript
game.pushScene()
game.popScene()

```

When you call `pushScene()`, all of your sprites, tilemaps, and game update code will be hidden away and paused until you call `popScene()`. Then, any new sprites you created in the meantime will get deleted and you’ll return to the paused game.

This is how the menu button works “under the hood”. You can also override the menu by registering a button event for it.
