Hello. Well basically my camera should follow the main character ( platform game). But there is one problem .. The character is not in the frame .. He is created in the frame with a function so i cant give him an instance name . The best thing i managed to do so far is to use the mouse to grab,ungrab the camera and move it .. but that is not so useful since i am going to use the mouse click to drop some stuff..So if anyone got any suggestion tell me ... btw here`s how the char is created in the frame
Code:
public function Create(x:Number, y:Number, width:Number = 50, height:Number = 80){
bodyDef = new b2BodyDef();
bodyDef.position.x = (x)/physScale;
bodyDef.position.y = (y)/physScale;
boxDef = new b2PolygonDef();
boxDef.SetAsBox(GetRealWH(20), GetRealWH(20));
boxDef.density = 1.0;
boxDef.friction = 0.3;
boxDef.restitution = 0.2;
bodyDef.userData = new PlayerBox();
bodyDef.userData.name = "jumper";
bodyDef.userData.width = physScale * 2 * GetRealWH(width);
bodyDef.userData.height = physScale * 2 * GetRealWH(height);
body = m_world.CreateBody(bodyDef);
body.SetBullet(true);
body.CreateShape(boxDef);
body.SetMassFromShapes();
bodyDef.userData.body = body;
addChild(bodyDef.userData);
bodyDef = new b2BodyDef();
bodyDef.position.x = (x)/physScale;
bodyDef.position.y = (y)/physScale;
boxDef = new b2PolygonDef();
boxDef.SetAsBox(GetRealWH(20), GetRealWH(20));
boxDef.density = 1.0;
boxDef.friction = 0.3;
boxDef.restitution = 0.2;
bodyDef.userData = new PlayerBox();
bodyDef.userData.name = "jumper";
bodyDef.userData.width = physScale * 2 * GetRealWH(width);
bodyDef.userData.height = physScale * 2 * GetRealWH(height);
body = m_world.CreateBody(bodyDef);
body.SetBullet(true);
body.CreateShape(boxDef);
body.SetMassFromShapes();
bodyDef.userData.body = body;
addChild(bodyDef.userData);