# How to make a game over statement after object is being collided to a player

**URL:** <https://discourse.processing.org/t/how-to-make-a-game-over-statement-after-object-is-being-collided-to-a-player/39499>\
**Category:** Beginners\
**Created:** [October 30, 2022, 5:38am UTC](https://discourse.processing.org/t/how-to-make-a-game-over-statement-after-object-is-being-collided-to-a-player/39499 "2022-10-30T05:38:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lyca](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@Lyca](https://discourse.processing.org/u/Lyca)\
**Post date:** [October 30, 2022, 5:38am UTC](https://discourse.processing.org/t/how-to-make-a-game-over-statement-after-object-is-being-collided-to-a-player/39499/1 "2022-10-30T05:38:12Z")

</div>

Hi badly need your help. Im just a beginner and I coundn’t run my application as Im doing a game. where in if falling object from above hits the player game will end with a message “game over”

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [October 30, 2022, 6:33am UTC](https://discourse.processing.org/t/how-to-make-a-game-over-statement-after-object-is-being-collided-to-a-player/39499/2 "2022-10-30T06:33:59Z")

</div>

Set a marker to true when the player is hit

For example:

Before setup() `boolean gameOver=false;`

upon collision: `gameOver=true;`

In draw():

```auto
if(gameOver) {text("game over ",77,77);
}else {
// what you have in draw () now
}

```

---

<div class="post-metadata">

**Author:** ![Lyca](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@Lyca](https://discourse.processing.org/u/Lyca)\
**Post date:** [October 30, 2022, 9:58am UTC](https://discourse.processing.org/t/how-to-make-a-game-over-statement-after-object-is-being-collided-to-a-player/39499/3 "2022-10-30T09:58:08Z")

</div>

Is there any easiest way to explain it? sorry for the trouble. I just couldnt get it so well

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [October 30, 2022, 10:03am UTC](https://discourse.processing.org/t/how-to-make-a-game-over-statement-after-object-is-being-collided-to-a-player/39499/4 "2022-10-30T10:03:58Z")

</div>

Set a marker to true when the player is hit

Evaluate the marker so draw has two different  
states what it does

---

<div class="post-metadata">

**Author:** ![Lyca](https://avatars.discourse-cdn.com/v4/letter/l/839c29/32.png) [@Lyca](https://discourse.processing.org/u/Lyca)\
**Post date:** [October 30, 2022, 10:05am UTC](https://discourse.processing.org/t/how-to-make-a-game-over-statement-after-object-is-being-collided-to-a-player/39499/5 "2022-10-30T10:05:28Z")

</div>

do you have any sample codes for that?

---

<div class="post-metadata">

**Author:** ![Divitiacus](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@Divitiacus](https://discourse.processing.org/u/Divitiacus)\
**Post date:** [October 30, 2022, 5:39pm UTC](https://discourse.processing.org/t/how-to-make-a-game-over-statement-after-object-is-being-collided-to-a-player/39499/6 "2022-10-30T17:39:32Z")

</div>

Lyca,

How do you test that the falling object has hit the player? Could you show the code?  
Then we could let you know, where to enter @Chrisir 's line of code.

Thanks,  
Frank
