# 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:** 1
**Showing post:** 4

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

---

_[View the full topic](https://forum.makecode.com/t/how-set-a-button-to-pause-the-game/2381)._
