Forum Topic: Multiple attack problem

(111 views • 2 replies)

This topic is 1 page long.

<< < > >>
None

Absolute-Requiem

Reply To Post Reply & Quote

Posted at: 7/10/06 12:53 PM

Absolute-Requiem NEUTRAL LEVEL 07

Sign-Up: 03/20/05

Posts: 3

Ok making a fighting game with some mates. i want it to like punch normaly, punch in the air and punch when crouching. it works normally and on jumping but doesnt work with crouching. heres the code:

onClipEvent (load) {
speed = 5;
facing = "left";
onFloor = true;
crouch = false;
jump = false;
punch = false;
kick = false;
}
onClipEvent (enterFrame) {
// Movement and turning to face enemy //
if (crouch == false) {
if (Key.isDown(Key.LEFT)) {
if (onFloor == true) {
this.gotoAndStop("walking");
}
if (facing == "left") {
this._x -= speed;
} else {
this._x -= speed/1.5;
}
}
if (Key.isDown(Key.RIGHT)) {
if (onFloor == true) {
this.gotoAndStop("walking");
}
if (facing == "right") {
this._x += speed;
} else {
this._x += speed/1.5;
}
}
}
if (this._x>_root.CPU._x) {
facing = "left";
this._xscale = -100;
} else if (this._x<_root.CPU._x) {
facing = "right";
this._xscale = 100;
}
if (!Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT) && onFloor == true) {
this.gotoAndStop(1);
}
// Basic attacks //
if (Key.isDown(68)) {
kick = true;
} else {
kick = false;
}
if (Key.isDown(65)) {
punch = true;
}else {
punch = false;
}
if (Key.isDown(87)) {
jump = true;
}else {
jump = false;
}
if (Key.isDown(83)) {
crouch = true;
}else {
crouch = false;
}

// act on the attacks //
if(punch == true && crouch == false && onFloor == true){
this.gotoAndStop("punch");
}
if(punch == true && crouch == true && onFloor == true && kick == false){
this.gotoAndStop("crouch punch");
}
if(punch == true && crouch == false && onFloor == false){
this.gotoAndStop("jump punch");
}
if(kick == true && crouch == false && onFloor == true){
this.gotoAndStop("kick");
}
if(kick == true && crouch == true && onFloor == true){
this.gotoAndStop("crouch kick");
}
if(kick == true && crouch == false && onFloor == false){
this.gotoAndStop("jump kick");
}
if(kick == false && crouch == true && onFloor == true){
this.gotoAndStop("crouch");
}
if(punch == false && crouch == true && onFloor == true){
this.gotoAndStop("crouch");
}
if(kick == false && crouch == false && onFloor == true && jump == true){
this.gotoAndStop("jump");
}
if(punch == false && crouch == false && onFloor == true && jump == true){
this.gotoAndStop("jump");
}
}

any ideas why its not working#? thnaks in advance


None

edit-undo

Reply To Post Reply & Quote

Posted at: 7/10/06 02:57 PM

edit-undo LIGHT LEVEL 18

Sign-Up: 01/17/06

Posts: 1,759

Are there any rrors listed in the output panel? If so, read them and try to understand them. If not, are you sure you spelt everything correctly? Capital letters in all the right places? Have you named the frames correctly?

might not be the most helpful of advice, but its the best i can do...

lolsigtrend
i just wanna fit in :'(

BBS Signature

None

Absolute-Requiem

Reply To Post Reply & Quote

Posted at: 7/11/06 08:25 AM

Absolute-Requiem NEUTRAL LEVEL 07

Sign-Up: 03/20/05

Posts: 3

no output pannel clear and ive been very carefull to check all instance names and lables. but it doesnt matter because i ave found a new way around the problem but thanks for thehelp all the same.


All times are Eastern Standard Time (GMT -5) | Current Time: 08:23 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!