PDA

View Full Version : [AS2] User defined controls


MasalaFingers
09-15-2008, 12:16 PM
Hey Everyone,

How do you make user defined controls i.e. the player can decide which keys to press to jump, move etc.?

Thanks,
MF

mildSoup
09-21-2008, 07:50 AM
basically. you have variables that hold the functions that control the player Object. Using a GUI, you could have the person choose which key does which function like:

A = jump

so then

var keyAfunction:function;

//under the GUI
keyAfunction = jump();

//somewhere on the main timeline
function jump(){
player.gotoAndPlay("jump");
//or however you want to make the jump happen
}


//key listener
'when key A is press'{
keyAfunction;
}