Example #1
0
        // Constructor
        public SpikeTile(World world, Vector2 position, float width, float height)
            : base(world)
        {
            this.Width  = ConvertUnits.ToSimUnits(width);
            this.Height = ConvertUnits.ToSimUnits(height);

            // Make the spike in the physics world
            physicsObj = new StaticPhysicsObject(this, this.world, position, width, height);
            physicsObj.body.Restitution  = 0f;
            physicsObj.CollisionCategory = GameConstants.GroundCollisionCategory | GameConstants.DeathCollisionCategory;
        }
Example #2
0
        // Constructor
        public SpikeTile(World world, Vector2 position, float width, float height)
            : base(world)
        {
            this.Width = ConvertUnits.ToSimUnits(width);
            this.Height = ConvertUnits.ToSimUnits(height);

            // Make the spike in the physics world
            physicsObj = new StaticPhysicsObject(this, this.world, position, width, height);
            physicsObj.body.Restitution = 0f;
            physicsObj.CollisionCategory = GameConstants.GroundCollisionCategory | GameConstants.DeathCollisionCategory;
        }
Example #3
0
        // Constructor
        public GroundTile(World world, Vector2 position, float width, float height, float rotation)
            : base(world)
        {
            this.Width    = ConvertUnits.ToSimUnits(width - 0.1f); // the 0.1f _might_ fix a weird bug in farseer
            this.Height   = ConvertUnits.ToSimUnits(height);
            this.rotation = rotation;

            // Make the ground in the physics world
            physicsObj = new StaticPhysicsObject(this, this.world, position, width, height);
            physicsObj.body.Restitution  = 0f;
            physicsObj.CollisionCategory = GameConstants.GroundCollisionCategory;
        }
Example #4
0
        // Constructor
        public GroundTile(World world, Vector2 position, float width, float height, float rotation)
            : base(world)
        {
            this.Width = ConvertUnits.ToSimUnits(width - 0.1f); // the 0.1f _might_ fix a weird bug in farseer
            this.Height = ConvertUnits.ToSimUnits(height);
            this.rotation = rotation;

            // Make the ground in the physics world
            physicsObj = new StaticPhysicsObject(this, this.world, position, width, height);
            physicsObj.body.Restitution = 0f;
            physicsObj.CollisionCategory = GameConstants.GroundCollisionCategory;
        }
Example #5
0
        // Constructor
        public CheckpointTile(World world, Vector2 position, float width, float height, EntityManager entityManager)
            : base(world)
        {
            this.Width = ConvertUnits.ToSimUnits(width);
            this.Height = ConvertUnits.ToSimUnits(height);
            this.Activated = false;
            this.entityManager = entityManager;

            // Make the checkpoint in the physics world only as a sensor
            physicsObj = new StaticPhysicsObject(this, this.world, position, width, height);
            physicsObj.body.IsSensor = true;
            physicsObj.body.OnCollision += new OnCollisionEventHandler(onCollision);
        }
Example #6
0
        // Constructor
        public CheckpointTile(World world, Vector2 position, float width, float height, EntityManager entityManager)
            : base(world)
        {
            this.Width         = ConvertUnits.ToSimUnits(width);
            this.Height        = ConvertUnits.ToSimUnits(height);
            this.Activated     = false;
            this.entityManager = entityManager;

            // Make the checkpoint in the physics world only as a sensor
            physicsObj = new StaticPhysicsObject(this, this.world, position, width, height);
            physicsObj.body.IsSensor     = true;
            physicsObj.body.OnCollision += new OnCollisionEventHandler(onCollision);
        }