예제 #1
0
 public Gate(Game1 Doc, float X, float Y, float Z)
     : base(Doc, X, Y, Z, Doc.LoadTex("Gate"))
 {
     scale = 1f;
     isFloor = false;
     createRecBody(1, 0, 0.5f, true, true);
 }
예제 #2
0
 public Wall(Game1 Doc, float X, float Y, float Z, int width, int height)
     : base(Doc, X, Y, Z, Doc.LoadTex("Platform"))
 {
     scale = 1f;
     isFloor = true;
     //body = BodyFactory.CreateRectangle(doc.getWorld(), ConvertUnits.ToSimUnits(tex.Width), ConvertUnits.ToSimUnits(tex.Height), 1f, new Vector2( ConvertUnits.ToSimUnits(x),  ConvertUnits.ToSimUnits(y)));
     //body.IsStatic = true;
     //body.Restitution = 0.2f;
     //if (isFloor)
     //{
     //    body.Friction = 0.5f;
     //}
     //body.FixedRotation = true;
     createRecBody(1,0, 0.5f, false, true);
 }
예제 #3
0
 public Wall(Game1 Doc, float X, float Y, float Z, int width, int height)
     : base(Doc, X, Y, Z, Doc.LoadTex("Platform"))
 {
     scale   = 1f;
     isFloor = true;
     //body = BodyFactory.CreateRectangle(doc.getWorld(), ConvertUnits.ToSimUnits(tex.Width), ConvertUnits.ToSimUnits(tex.Height), 1f, new Vector2( ConvertUnits.ToSimUnits(x),  ConvertUnits.ToSimUnits(y)));
     //body.IsStatic = true;
     //body.Restitution = 0.2f;
     //if (isFloor)
     //{
     //    body.Friction = 0.5f;
     //}
     //body.FixedRotation = true;
     createRecBody(1, 0, 0.5f, false, true);
 }
예제 #4
0
 public Key(Game1 Doc, float X, float Y, float Z, Color color)
     : base(Doc, X, Y, Z, Doc.LoadTex("Key"))
 {
     this.color = color;
     gates = new List<Gate>();
 }
예제 #5
0
 public Player(Game1 Doc, float X, float Y, float Z)
     : base(Doc,X,Y,Z,Doc.LoadTex("Character"))
 {
     Global.Player = this;
     scale = 0.5f;
     //Point = new Obj(doc
     createRecBody(10, 0, 1f, true,false);
     obj = new Obj(doc, x + 200, y + 200, z, doc.LoadTex("Square"));
     obj.createRecBody(1,0.5f,0.3f, true, true);
     obj2 = new Obj(doc, x + 800, y + 400, z, doc.LoadTex("Square"));
     obj2.createRecBody(1, 0.5f, 0.3f, true, true);
     obj.type = obj2.type = Obj.PointType.SwingPoint;
     //body.JointList = new JointEdge();
     //JointFactory.CreateDistanceJoint(doc.getWorld(), body, obj.body, /*ConvertUnits.ToSimUnits(pos.ToVector2() + new Vector2(0,400))*/body.Position, obj.body.Position);
     //r = JointFactory.CreateRevoluteJoint(doc.World, body, obj.body, obj.body.Position);
     /*f = JointFactory.CreateDistanceJoint(doc.World, body, obj.body, obj.body.Position, obj.body.Position);
     f.Frequency = 100;*/
     //Console.WriteLine(r.MotorEnabled);
     //body.JointList.Other = obj.body;
     //body.JointList.Other
     whip = new Obj[7];
     for (int i = 0; i < whip.Length; i++)
     {
         Obj w = new Obj(doc, x + 50 +  (i * 50), y, z, doc.LoadTex("Square"));
         whip[i] = w;
         w.Scale.X = 0.5f;
         w.Scale.Y = 0.5f;
         w.createRecBody(1, 0, 0, true, false);
         w.body.IgnoreCollisionWith(body);
         if (i > 0)
         {
             for (int o = i - 1; o >= 0; o--)
             {
                 w.body.IgnoreCollisionWith(whip[i].body);
             }
         }
         if (i == 0)
         {
             f = JointFactory.CreateDistanceJoint(doc.World, body, w.body, w.body.Position, w.body.Position);
             f.DampingRatio = 1f;
             f.Length = ConvertUnits.ToSimUnits(150);
         }
         else
         {
             f = JointFactory.CreateDistanceJoint(doc.World, w.body, whip[i - 1].body, whip[i - 1].body.Position, whip[i - 1].body.Position);
             f.DampingRatio = 1f;
             f.Frequency = 20;
             f.Length = ConvertUnits.ToSimUnits(50);
         }
         if (i == whip.Length - 1)
         {
             w.body.Position = obj.body.Position;
             whipPoint = w;
             whipJoint = JointFactory.CreateDistanceJoint(doc.World, w.body, obj.body, obj.body.Position, obj.body.Position);
             Console.WriteLine(whipJoint.Frequency);
             whipJoint.Frequency = 10f;
             whipJoint.Length = ConvertUnits.ToSimUnits(10);
             whipJoint.DampingRatio = 1;
         }
     }
 }