public override void Collide(Entity entity) { base.Collide(entity); if (bounds.Top < entity.GetBounds().Bottom - 16) velocity.X = MathHelper.Clamp(entity.GetVelocity().X * 2, -400, 400); }
public override void Collide(Entity entity) { base.Enter(entity); if (entity is PlayerEntity) ((PlayerEntity)entity).OnGrounded(); else return; Block block; if (Id % 2 == 0) block = Level.GetBlockById(Id + 1); else block = Level.GetBlockById(Id - 1); entity.SetPosition(block.GetPosition() - new Vector2(0, entity.GetBounds().Height)); float vy = Math.Min(-500, entity.GetVelocity().Y * -.89f); entity.SetVelocity(0, vy); }
public override void Collide(Entity entity) { base.Collide(entity); if (entity is PlayerEntity) { if (velocity.Y >= 0 && entity.GetBounds().Bottom < position.Y) { Alive = false; entity.SetVelocity(entity.GetVelocity().X, 400); } else { Alive = false; entity.Alive = false; } } if (entity is BulletEntity) { Alive = false; } }
public override void Collide(Entity entity) { base.Collide(entity); if (entity is PlayerEntity) { if (velocity.Y >= 0 && entity.GetBounds().Bottom < position.Y) { //Alive = false; //entity.SetVelocity(entity.GetVelocity().X, 400); } else ((PlayerEntity)entity).Alive = false; } if (entity is BulletEntity) { if (((BulletEntity)entity).Owner != this) Hurt(); } }