# Yes, its me, da newb. releasing help

**URL:** https://forum.kirupa.com/t/yes-its-me-da-newb-releasing-help/57866
**Category:** Uncategorized
**Created:** [July 16, 2004, 10:14pm UTC](https://forum.kirupa.com/t/yes-its-me-da-newb-releasing-help/57866 "2004-07-16T22:14:39Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![elPooter](https://avatars.discourse-cdn.com/v4/letter/e/839c29/32.png) [@elPooter](https://forum.kirupa.com/u/elPooter)
#### Post date: [July 16, 2004, 10:14pm UTC](https://forum.kirupa.com/t/yes-its-me-da-newb-releasing-help/57866/1 "2004-07-16T22:14:39Z")

</div>

Hello all, I have been programming a sideScrolling action game, and I have run into yet another problem. When I press the punch button, The character will play the “punch” sequence, but if you hold down the key, he will keep punching. I have devised a code, but it still is messed.

```php
 
onClipEvent (enterFrame) {
	if (!this.punching) {
		if (Key.isDown(90)) {
			this.gotoAndStop("punch");
			this.punching = true;
			}
	 }
}
onClipEvent (keyUp) {
	if (Key.getCode() == 90) {
		this.punching = false;
	 }
}

```

If anyone knows, please reply. Thanks:thumb:.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 17, 2004, 10:52am UTC](https://forum.kirupa.com/t/yes-its-me-da-newb-releasing-help/57866/2 "2004-07-17T10:52:57Z")

</div>

shouldn’t ya just put it so goto the non punching frame on the second one?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 17, 2004, 3:14pm UTC](https://forum.kirupa.com/t/yes-its-me-da-newb-releasing-help/57866/3 "2004-07-17T15:14:09Z")

</div>

> 

shouldn’t ya just put it so goto the non punching frame on the second one?

No, that would just make him stop punching when you release it. What I want the character to do is punch only ounce if you hold down, or press the punching key unless you release it. If I dont make sence, tell me (I cant explain things worth crap :crazy: ).

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 20, 2004, 2:27pm UTC](https://forum.kirupa.com/t/yes-its-me-da-newb-releasing-help/57866/4 "2004-07-20T14:27:46Z")

</div>

I thin kwhat you want is that when you hold the punch key it continually plays the punching sequence of frames, but when you realease you want him to stop punching, but still complete the sequence:

```auto

onClipEvent (keyDown) {
     if (Key.getCode() == 90) {
          this.gotoAndPlay("punch");
          this.punching = true;
          this.donepunching = false;
     }
}
onClipEvent (keyUp) {
     if (Key.getCode() == 90) {
          this.punching = false;
     }
}
//on last frame of punching sequence
if(this.punching) {
     this.gotoAndPlay("punch");
} else {
     this.stop();
     this.donepunching = true;
}
/*CHANGES
-on keyDown instead of onEnterFrame
-gotoAndPlay instead of gotoAndStop in keyDown block.
-Frame actions
-added done punching variable so you know he is still punching even when the key isn't pressed because you don't want his punches to become in effective just because you released the key
*/

```

\</FONT\>

[font=Courier New]Hope that helps.[/font]

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [July 20, 2004, 10:29pm UTC](https://forum.kirupa.com/t/yes-its-me-da-newb-releasing-help/57866/5 "2004-07-20T22:29:51Z")

</div>

Thanks 😃
