PDA

View Full Version : Movement Keys Help PLZ



JoRdAnMaN
March 12th, 2006, 01:41 PM
Im using this simple movement keys script,i just wanna know how would i be able to edit this scrip so that i would be able to put it on another mc1 but when u press the keys mc2 moves. Or if anyone has another script thats betetr that would be cool.


on (keyPress "<Left>") {
currentX = this._x;
this._x = currentX-2;
}
on (keyPress "<Right>") {
currentX = this._x;
this._x = currentX+2;
}

bombsledder
March 12th, 2006, 02:02 PM
are you trying to make 2 mcs move at once and yes i have a better script


_root.onEnterFrame=function(){
if(Key.isDown(Key.LEFT)){
mc1._x-=2
mc2._x-=2
}
if(Key.isDown(Key.RIGHT)){
mc1._x+=2
mc2._x+=2
}
}

JoRdAnMaN
March 12th, 2006, 02:22 PM
i was able to put that onto a frame but how would i put that onto the mc1, i didnt need mc1 to move just mc2. thx

GPP
March 12th, 2006, 02:31 PM
This?



onClipEvent(enterFrame) {
if(Key.isDown(Key.LEFT)) {
_root.mc2._x-=2
}
if(Key.isDown(Key.RIGHT)) {
_root.mc2._x+=2
}
}


I am wondering why you want to put it on mc1 to move mc2... why not just put this script in mc2?

JoRdAnMaN
March 12th, 2006, 02:36 PM
there we go thx, i tryed putting a handler on the script before but i didnt remove the

_root.onEnterFrame=function(){

now it works fine :)

GPP
March 12th, 2006, 02:38 PM
Ok lol :)

nathan99
March 12th, 2006, 05:56 PM
onClipEvent(enterFrame) {
if(Key.isDown(Key.LEFT)) {
_root.mc2._x-=2
}
if(Key.isDown(Key.RIGHT)) {
_root.mc2._x+=2
}
}

Just for the record, this method is becoming deprecated. Start using frame based codes ;)

bombsledder
March 12th, 2006, 07:16 PM
that's why i posted mine frame based XD

GPP
March 12th, 2006, 07:45 PM
Just for the record, this method is becoming deprecated. Start using frame based codes ;)

I know he asked for the clip version :tie: