DemonicEZZA
07-07-2008, 11:03 AM
I Want My Character To Be Able To Jump But
I Don't Want Him To Be Able To Fly Or Double
Jump Here Is My Current Code:
onClipEvent (load) {
speed=7;
isJumping = false;
jumpSpeed = 0;
startY = _y;
}
onClipEvent (enterFrame) {
if(isJumping) {
_y += jumpSpeed;
jumpSpeed+=1;
if(_y>startY) {
_y = startY;
isJumping=false;
}
}
if (Key.isDown(Key.UP)) {
gotoAndStop("jump")
isJumping = true;
jumpSpeed = -10;
}
if (Key.isDown(Key.RIGHT)) {
this.gotoAndStop("runr");
this._x += 25;
}
if (Key.isDown(Key.LEFT)) {
this.gotoAndStop("runl");
this._x -= 25;
}
if (Key.isDown(Key.DOWN)) {
this.gotoAndStop("duck");
}
}
onClipEvent (keyUp) {
this.gotoAndStop("stop");
}
I Don't Want Him To Be Able To Fly Or Double
Jump Here Is My Current Code:
onClipEvent (load) {
speed=7;
isJumping = false;
jumpSpeed = 0;
startY = _y;
}
onClipEvent (enterFrame) {
if(isJumping) {
_y += jumpSpeed;
jumpSpeed+=1;
if(_y>startY) {
_y = startY;
isJumping=false;
}
}
if (Key.isDown(Key.UP)) {
gotoAndStop("jump")
isJumping = true;
jumpSpeed = -10;
}
if (Key.isDown(Key.RIGHT)) {
this.gotoAndStop("runr");
this._x += 25;
}
if (Key.isDown(Key.LEFT)) {
this.gotoAndStop("runl");
this._x -= 25;
}
if (Key.isDown(Key.DOWN)) {
this.gotoAndStop("duck");
}
}
onClipEvent (keyUp) {
this.gotoAndStop("stop");
}