# Help with game plz

**URL:** <https://forum.kirupa.com/t/help-with-game-plz/173285>\
**Category:** Uncategorized\
**Created:** [December 22, 2005, 9:56pm UTC](https://forum.kirupa.com/t/help-with-game-plz/173285 "2005-12-22T21:56:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Icehawk](https://avatars.discourse-cdn.com/v4/letter/i/51bf81/32.png) [@Icehawk](https://forum.kirupa.com/u/Icehawk)\
**Post date:** [December 22, 2005, 9:56pm UTC](https://forum.kirupa.com/t/help-with-game-plz/173285/1 "2005-12-22T21:56:49Z")

</div>

hi i started to make a game dont mind the bad graphics its just the developing graphics. i need some help with the action script its not working so great…  
can some 1 help me so i can jump on the box and jump over it but not go trough it???  
also does ne 1 know what id use in hittest to make it when i hit the black pit to goto a certain frame???.  
lastly how can i make the level move so that it scrolls when the keys are pressed?  
[http://ca.geocities.com/scotteffer@rogers.com/gameexample.fla](http://ca.geocities.com/scotteffer@rogers.com/gameexample.fla)

[size=1]onClipEvent(load){  
speed=5;  
Direction=“right”  
this.gotoAndStop(“lookright”);  
}  
onClipEvent(enterFrame){  
if(Key.isDown(Key.RIGHT)){  
Direction=“right”  
this.\_x += speed;  
}  
if(Key.isDown(Key.LEFT)){  
Direction=“left”  
this.\_x -= speed;  
}  
if(Key.isDown(Key.RIGHT)&& !jumping){  
this.gotoAndStop(“walkright”);  
}  
if(Key.isDown(Key.LEFT)&& !jumping){  
this.gotoAndStop(“walkleft”);  
}  
}  
onClipEvent (keyUp) {  
if (Key.getCode() == Key.RIGHT && !jumping) {  
this.gotoAndStop(“lookright”);  
}  
if (Key.getCode() == Key.LEFT && !jumping) {  
this.gotoAndStop(“lookleft”);  
}  
}  
//jumping script  
onClipEvent(enterFrame){  
if(Key.isDown(Key.UP)){  
if(Direction==“right”){  
this.gotoAndStop(“jumpright”);  
jumping=true;  
}else if(Direction==“left”){  
this.gotoAndStop(“jumpleft”);  
jumping=true;  
}  
}  
}  
onClipEvent (load) {  
jump = 10;  
}  
onClipEvent (enterFrame) {  
if (Key.isDown(Key.UP)) {  
jumping=1  
}  
if(jumping==1){  
\_y-=jump  
if(jump\>-11){  
jump–  
}  
if(\_root.ground.hitTest(this)){  
jump=10;  
jumping=0  
if(Direction==“right”){  
this.gotoAndStop(“lookright”);  
jumping=false;  
}else if(Direction==“left”){  
this.gotoAndStop(“lookleft”);  
jumping=false;  
}  
}  
}  
//HERE ARE THE CHANGES//  
if (\_root.obstacle.hitTest(this) && \_y\>350) {  
jump = 0;  
//allows jump while is on top of the obstacle//  
if (Key.isDown(key.UP)) {  
jump = 10;  
}  
}  
if (\_root.obstacle.hitTest(this) && \_y\>362) {  
//recognize the object from two directions//  
if (Direction==“right”) {  
\_x -= 5;  
} else {  
\_x+= 5;  
}  
}

}[/size]
