Esempio n. 1
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            spc = new ChipmunkSharp.cpSpace();
            spc.SetGravity(new ChipmunkSharp.cpVect(0, 1f));
            spc.AddDefaultCollisionHandler().preSolveFunc = new Func <cpArbiter, cpSpace, object, bool> ((arg1, arg2, arg3) => { Console.WriteLine("ij"); return(true); });
            spc.AddDefaultCollisionHandler().beginFunc    = new Func <cpArbiter, cpSpace, object, bool> ((arg1, arg2, arg3) => { Console.WriteLine("ij"); return(true); });
        }
Esempio n. 2
0
        public PhysicObject(Texture2D firstText, Vector2 startingPos, ChipmunkSharp.cpSpace space, bool isKinematic = false) : base(firstText, startingPos)
        {
            trsf = new cpTransform();
            collCount++;
            physic = new cpBody(1000, cp.PHYSICS_INFINITY);

            if (isKinematic)
            {
                physic.SetBodyType(cpBodyType.KINEMATIC);
            }
            shp = new ChipmunkSharp.cpCircleShape(physic, 100, ChipmunkSharp.cpVect.Zero);
            shp.Active();
            shp.SetSensor(true);
            shp.SetCollisionType(1);
            physic.SetPosition(new ChipmunkSharp.cpVect(Position.X, Position.Y));
            if (space != null)
            {
                space.AddBody(physic);
                space.AddShape(shp);
                this.space = space;
            }
        }