# How do you make buttons in game lab

**URL:** <https://forum.code.org/t/how-do-you-make-buttons-in-game-lab/41801>\
**Category:** Coding and Debugging Help\
**Created:** [February 18, 2026, 2:36am UTC](https://forum.code.org/t/how-do-you-make-buttons-in-game-lab/41801 "2026-02-18T02:36:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![stazzarama](https://avatars.discourse-cdn.com/v4/letter/s/90ced4/32.png) [@stazzarama](https://forum.code.org/u/stazzarama)\
**Post date:** [February 18, 2026, 2:36am UTC](https://forum.code.org/t/how-do-you-make-buttons-in-game-lab/41801/1 "2026-02-18T02:36:16Z")

</div>

Im making a game that uses entirely buttons for every thing but i dont know have to make buttons and i need 16 buttons for the code to work but i dont know how to make even one please help me

---

<div class="post-metadata">

**Author:** ![pluto](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/pluto/32/9141_2.png) [@pluto](https://forum.code.org/u/pluto)\
**Post date:** [February 18, 2026, 3:01pm UTC](https://forum.code.org/t/how-do-you-make-buttons-in-game-lab/41801/2 "2026-02-18T15:01:17Z")

</div>

Greetings @stazzarama,

There is an efficient solution to this: the mousePressedOver(). This simply detects if the mouse is over for the sprite.

```auto
if (mousePressedOver("sprite")) {
  console.log ("do stuff")
}

```

However, I find this function a little buggy at times where one click can equal multiple. So personally, I use this way:

```auto
if (mouseIsOver("sprite") && mouseWentDown("leftButton")) { //checks if mouse is over the sprite and the mouse is clicked
  console.log("do stuff");
}

```

Now if you don’t know how to make a button, just make a sprite for it.

```auto
var sprite = createSprite(200, 200)
sprite.setAnimation("button name here");

function draw () {
  drawSprites();
}

```
