# Script Help please

**URL:** <https://forum.kirupa.com/t/script-help-please/166741>\
**Category:** Uncategorized\
**Created:** [October 22, 2005, 11:13am UTC](https://forum.kirupa.com/t/script-help-please/166741 "2005-10-22T11:13:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DarkDepts](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@DarkDepts](https://forum.kirupa.com/u/DarkDepts)\
**Post date:** [October 22, 2005, 11:13am UTC](https://forum.kirupa.com/t/script-help-please/166741/1 "2005-10-22T11:13:30Z")

</div>

This is a script I took from a fighting game tutorial on newgrounds.

> onClipEvent (load) {  
> speed = 7;  
> inair = false  
> upright = false;  
> upleft = false;  
> starty = 325;  
> maxy = 75;  
> movey = 25;  
> \_root.punch = false;  
> \_root.kick = false;  
> }  
> onClipEvent (enterFrame){  
> if (!Key.isDown(Key.LEFT) and !Key.isDown(Key.RIGHT) and !Key.isDown(Key.DOWN) and inair == false and this.\_currentframe\>1 and \_root.punch == false and \_root.kick == false) {  
> this.gotoAndStop(2);  
> down = false;  
> }  
> if (Key.isDown(Key.RIGHT) and !Key.isDown(Key.UP) and inair == false and this.\_currentframe\>1) {  
> this.gotoAndStop(3);  
> this.\_x += speed;  
> }  
> else if (Key.isDown(Key.LEFT) and !Key.isDown(Key.UP) and inair == false and this.\_currentframe\>1) {  
> this.gotoAndStop(4);  
> this.\_x -= speed;  
> }  
> else if (Key.isDown(Key.DOWN) and inair == false and this.\_currentframe\>1) {  
> this.gotoAndStop(5);  
> }  
> else if (Key.isDown(Key.UP) and inair == false and !Key.isDown(Key.LEFT) and !Key.isDown(Key.RIGHT) and !Key.isDown(Key.DOWN) and this.\_currentframe\>1) {  
> up = true;  
> this.gotoAndStop(6);  
> }  
> else if (Key.isDown(Key.UP) and Key.isDown(Key.RIGHT) and inair == false and this.\_currentframe\>1) {  
> upright = true;  
> this.gotoAndStop(7);  
> }  
> else if (Key.isDown(Key.UP) and Key.isDown(Key.LEFT) and inair == false and this.\_currentframe\>1) {  
> upleft = true;  
> this.gotoAndStop(8);  
> }  
> }  
> onClipEvent (enterFrame) {  
> if (this.\_y\>=starty) {  
> this.\_y = starty;  
> }  
> }  
> onClipEvent (enterFrame) {  
> if (up == true) {  
> \_root.updir = “up”;  
> } else if (upright == true) {  
> \_root.updir = “upright”;  
> } else if (upleft == true) {  
> \_root.updir = “upleft”;  
> }  
> }  
> onClipEvent (enterFrame) {  
> if (up == true and this.\_y\>=maxy) {  
> this.\_y -= movey;}  
> if (this.\_y == maxy) {  
> up = false;}  
> if (upleft == false and up == false and upright == false and (\_root.updir == “up”) and this.\_y\<starty) {  
> this.\_y += movey;  
> }  
> }  
> onClipEvent (enterFrame) {  
> if (upright == true and this.\_y\>=maxy) {  
> this.\_y -= movey;  
> this.\_x += speed;}  
> if (this.\_y == maxy) {  
> upright = false;}  
> if (upleft == false and upright == false and up == false and (\_root.updir == “upright”) and this.\_y\<starty) {  
> this.\_y += movey;  
> this.\_x += speed;  
> }  
> }  
> onClipEvent (enterFrame) {  
> if (upleft == true and this.\_y\>=maxy) {  
> this.\_y -= movey;  
> this.\_x -= speed;}  
> if (this.\_y == maxy) {  
> upleft = false;}  
> if (upleft == false and up == false and upright == false and (\_root.updir == “upleft”) and this.\_y\<starty) {  
> this.\_y += movey;  
> this.\_x -= speed;  
> }  
> else if (Key.isDown(90) and inair == false and this.\_currentframe\>1) {  
> \_root.punch = true;  
> this.gotoAndStop(9);  
> } else if (Key.isDown(65) and inair == false and this.\_currentframe\>1) {  
> \_root.punch = true;  
> this.gotoAndStop(10);  
> } else if (Key.isDown(81) and inair == false and this.\_currentframe\>1) {  
> \_root.punch = true;  
> this.gotoAndStop(11);  
> }  
> else if (Key.isDown(88) and inair == false and this.\_currentframe\>1) {  
> \_root.kick = true;  
> this.gotoAndStop(12);  
> } else if (Key.isDown(83) and inair == false and this.\_currentframe\>1) {  
> \_root.kick = true;  
> this.gotoAndStop(13);  
> } else if (Key.isDown(87) and inair == false and this.\_currentframe\>1) {  
> \_root.kick = true;  
> this.gotoAndStop(14);  
> }  
> }  
> onClipEvent (enterFrame) {  
> if (this.\_y\>=starty) {  
> this.\_y = starty;  
> }  
> }  
> onClipEvent (enterFrame) {  
> if (this.\_y\<starty) {  
> inair = true;  
> } else if (this.\_y\>=starty) {  
> inair = false;  
> }  
> }

Its the last part that makes the character fail to work but it is essencial to the jump script.

Sorry but my links are’nt working so I can’t show you the .fla or swf.

[url=“[http://http](http://http)://www.freewebs.com/darkdepts/StreetFighter2.fla”]
