# Simple question about a bool

**URL:** <https://forum.kirupa.com/t/simple-question-about-a-bool/292397>\
**Category:** Uncategorized\
**Created:** [July 14, 2009, 12:18am UTC](https://forum.kirupa.com/t/simple-question-about-a-bool/292397 "2009-07-14T00:18:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Press\_Tilty](https://avatars.discourse-cdn.com/v4/letter/p/e480ec/32.png) [@Press\_Tilty](https://forum.kirupa.com/u/Press_Tilty)\
**Post date:** [July 14, 2009, 12:18am UTC](https://forum.kirupa.com/t/simple-question-about-a-bool/292397/1 "2009-07-14T00:18:19Z")

</div>

hey, so I’ve posted a couple of questions about jumping lately, but before I attack the had part of only being able to jump so high, my question is, how do I stop the hero from jumping while in the air?

here is my code that determines the state of my touchingGround boolean:

```auto

if (_root.popeman, hitTest(_root.ground)) {
		touchingGround = true;
	} else {
		touchingGround = false;
	}

```

popeman is the hero, ground clip is exactly what it sounds like.  
this is my simple jump code:

```auto

if (Key.isDown(Key.UP)){
		grav = maxJump;
	}

```

it works perfectly, but I can just hold the key, and when I let go it drops, easy peasy.  
my question, to clarify is:  
how can I have the initial key _press_ only work once (or until the ground is hit again).  
I tried

```auto

if (Key.isDown(Key.UP) && touchingGround = true){
		grav = maxJump;
	}

```

(any errors in the code are only here, i triple checked in Flash)

any help would be appreciated.
