# How to make bullet shoot only when the previous bullet is off the screen

**URL:** https://discourse.processing.org/t/how-to-make-bullet-shoot-only-when-the-previous-bullet-is-off-the-screen/32314
**Category:** Coding Questions
**Created:** [September 19, 2021, 1:38pm UTC](https://discourse.processing.org/t/how-to-make-bullet-shoot-only-when-the-previous-bullet-is-off-the-screen/32314 "2021-09-19T13:38:15Z")
**Posts on this page:** 1
**Showing post:** 2

<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: [September 19, 2021, 7:32pm UTC](https://discourse.processing.org/t/how-to-make-bullet-shoot-only-when-the-previous-bullet-is-off-the-screen/32314/2 "2021-09-19T19:32:43Z")

</div>

this would be enough:

just check if the bulletFlies and if so, leave

```auto
  else if (key == ' ') {
    if (bulletFlies)
      return; // leave
    bulletFlies=true;
    bulletX = gunX+14;
    bulletY = gunY+4;
  }

```

---

_[View the full topic](https://discourse.processing.org/t/how-to-make-bullet-shoot-only-when-the-previous-bullet-is-off-the-screen/32314)._
