I’m in the works of creating an RPG type adventure game starring Yoshi as the main character.
I can get him moving just fine but I’m struggling with the attack code.
The problems are hard to explain so I’ve attached the FLA download so you can see for your self.
Here’s an excerpt of the code:
yoshi_mc.onEnterFrame = function() { if(Key.isDown(Key.SHIFT)) { this.speed = this.runSpeed; }
else { this.speed = this.walkSpeed; }
if(Key.isDown(Key.UP)) {
this.ySpeed = -this.speed;
}
else if(Key.isDown(Key.DOWN)) {
this.ySpeed = this.speed;
}
else {
this.ySpeed = 0;
}
if(Key.isDown(Key.LEFT)) {
this.xSpeed = -this.speed;
}
else if(Key.isDown(Key.RIGHT)) {
this.xSpeed = this.speed;
}
else {
this.xSpeed = 0;
}
if(this.xSpeed == 0 && this.ySpeed == 0) {
this.walk.gotoAndStop("Stand");
}
else { this.walk.play(); }
if(this.xSpeed > 0) {
this.gotoAndStop("WalkRight");
}
else if(this.xSpeed < 0) {
this.gotoAndStop("WalkLeft");
}
else if(this.ySpeed > 0) {
this.gotoAndStop("WalkFront");
}
else if (this.ySpeed < 0) {
this.gotoAndStop("WalkBack");
}
if (Key.isDown (Key.CONTROL))
if (this.xSpeed > 0) {
this.gotoAndStop("AttackRight");
}
else if(this.xSpeed < 0) {
this.gotoAndStop("AttackLeft");
}
I think it has something to do with the Attack code being included with the Walking code, and that I don’t have any keydown variables.
Anyways, I would appreciate your help and here’s the FLA:[CENTER]Click Me![/CENTER]
[SIZE=1](I uploaded it to mediafire because it was to big)[/SIZE]
[SIZE=1](ignore all the hittest stuff. I deleted things so I could upload the FLA)[/SIZE]
Thank you!