im making a game that uses 4 different characters, and uses this script to place the caracter of choice
//emilia is on of 4 char statements (jason, emilia, sam, and oogle)
player.addChild(new emilia());
player.x = 200;
player.y = 490;
the problem is that all the event scripting refers to player, because the player character can be variable, but the actions for each character are the same. when i did a trace it stated that player is an object and emilia was a class. is there any way to get all the different players to be “player”, in other words, react to anything that player is told to do.
here is a little sinpet of the actions code for an example
//this works fine just need to to be variable to player
function output(event:KeyboardEvent) {
switch (event.keyCode) {
case 37 :
player.x -= 5;
player.gotoAndStop(“left”)
break;
case 39 :
player.x += 5;
player.gotoAndStop(“right”)
break;
}
}
the gotoAndStop has no effect at all
please help… :hr: