PDA

View Full Version : Get a simple key movment here



SilverFalcon
March 25th, 2005, 04:56 PM
this is a code for a simple key movment you can go in all directions.
--------------------------------------------------------------------------
onClipEvent(enterFrame){
if(Key.isDown(Key.UP)){
this._y -= 5;
}
}
onClipEvent(enterFrame){
if(Key.isDown(Key.DOWN)){
this._y += 5;
}
}
onClipEvent(enterFrame){
if(Key.isDown(Key.LEFT)){
this._x -= 5;
}
}onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
this._x += 5;
}

}

-------------------------------------------------------------
for people who dont understand this code to change the speed where the "5" is change that to make it go faster or slower.
hope it works.

drosa10
March 25th, 2005, 08:52 PM
this is a code for a simple key movment you can go in all directions.
--------------------------------------------------------------------------
onClipEvent(enterFrame){
if(Key.isDown(Key.UP)){
this._y -= 5;
}
}
onClipEvent(enterFrame){
if(Key.isDown(Key.DOWN)){
this._y += 5;
}
}
onClipEvent(enterFrame){
if(Key.isDown(Key.LEFT)){
this._x -= 5;
}
}onClipEvent(enterFrame){
if(Key.isDown(Key.RIGHT)){
this._x += 5;
}

}

-------------------------------------------------------------
for people who dont understand this code to change the speed where the "5" is change that to make it go faster or slower.
hope it works.


you can put them all into one clipevent action.

SilverFalcon
March 26th, 2005, 04:06 AM
yes i suppose it would mkae it shorter and easier to understand. :s: