// 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; }
// 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; }
// 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); }