Forum Topic: Action Script Mc Movement

(226 views • 6 replies)

This topic is 1 page long.

<< < > >>
None

kamakazi-AKA-crazy

Reply To Post Reply & Quote

Posted at: 5/16/06 06:39 PM

kamakazi-AKA-crazy EVIL LEVEL 04

Sign-Up: 03/19/04

Posts: 64

I want to make an rpg and i im having a problem making the movement look like i want it to.

i want when i am holding up for example, for a movieclip to play, but i want it to stop the mc as soon as a let go of up. so far i have 8 directional movement with a mc animation for the (left, right, down and up) movement.....the problem is that even when i let go of up the movie clip continues to play. with a stop it goes to the end, which is not what i want

heres my as code

onClipEvent (load) {
// Set the move speed
moveSpeed = 5;
}
onClipEvent (enterFrame) {

if (Key.isDown(Key.RIGHT)) {
this._x+=moveSpeed;
this.gotoAndStop (2); //frame two of my character is a right movement mc animation
^^that line of code is where i need help ( how do i make is so that when i let go of up the mc on that frame stops imedietly

}else if (Key.isDown(Key.LEFT)) {
this._x-=moveSpeed;
this.gotoAndStop (1); //frame one of my character is a left movement mc animation

} if (Key.isDown(Key.DOWN)) {
this._y+=moveSpeed;
this.gotoAndStop (3);

} else if (Key.isDown(Key.UP)) {
this._y-=moveSpeed;
this.gotoAndStop (4);
}
}


None

Beavis-Love

Reply To Post Reply & Quote

Posted at: 5/16/06 11:09 PM

Beavis-Love DARK LEVEL 08

Sign-Up: 04/23/06

Posts: 1,572

Im not a fequent ASer but would it not have something to do with _currentframe? Like if the current frame is 3 when it stops then gotoandstop on frame three, thats just the idea i bet u can figure the code out.


None

Nuggs

Reply To Post Reply & Quote

Posted at: 5/16/06 11:16 PM

Nuggs LIGHT LEVEL 19

Sign-Up: 12/17/05

Posts: 1,222

make a standing-still picture and place it on frame 5 with a stop; command. then add this to your script

onClipEvent (keyUp) {
this.gotoAndStop(5);
}

Games|1|2|3| Movies|1|2|

BBS Signature

None

Chrispington

Reply To Post Reply & Quote

Posted at: 5/17/06 02:58 AM

Chrispington EVIL LEVEL 31

Sign-Up: 07/02/04

Posts: 1,247

just put

}else {
"stop whatever you are talking about "
}

elses rock

BBS Signature

None

sinz3ro

Reply To Post Reply & Quote

Posted at: 5/17/06 05:32 AM

sinz3ro NEUTRAL LEVEL 07

Sign-Up: 08/02/05

Posts: 598

this code will work

onClipEvent(keyUp){
if(Key.getCode(Key.WHATEVERKEY)){
_root.characterinstance.mcofmovement.stop(
);
}
}

// Harvest++ coming sometime later this year, with better graphics, more modes, more pointlessness!

BBS Signature

None

Skanky-Andy

Reply To Post Reply & Quote

Posted at: 5/17/06 05:44 AM

Skanky-Andy EVIL LEVEL 06

Sign-Up: 05/08/05

Posts: 198

onClipEvent (load) {
// Set the move speed
moveSpeed = 5;
}
onClipEvent (enterFrame) {

if (Key.isDown(Key.RIGHT)) {
this._x+=moveSpeed;
this.gotoAndStop (2); //frame two of my character is a right movement mc animation
^^that line of code is where i need help ( how do i make is so that when i let go of up the mc on that frame stops imedietly

}else if (Key.isDown(Key.LEFT)) {
this._x-=moveSpeed;
this.gotoAndStop (1); //frame one of my character is a left movement mc animation

} if (Key.isDown(Key.DOWN)) {
this._y+=moveSpeed;
this.gotoAndStop (3);

} if (Key.isDown(Key.UP)) {
this._y-=moveSpeed;
this.gotoAndStop (4);
} else if (!Key.isDown(Key.UP) && !Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT) && !Key.isDown(Key.DOWN)) {
this.gotoAndStop (put the frame with the guy stopped number here);
}
}
}


None

Skanky-Andy

Reply To Post Reply & Quote

Posted at: 5/17/06 05:45 AM

Skanky-Andy EVIL LEVEL 06

Sign-Up: 05/08/05

Posts: 198

i put 3 ending brackets at the end by accident sorry

(

All times are Eastern Standard Time (GMT -5) | Current Time: 01:49 PM

<< 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!