public override void HandleCollision(GameObjects p) { if (speed.X > 0 && Hitbox().Right > p.Hitbox().Left&& Hitbox().Center.Y > p.Hitbox().Top&& Hitbox().Center.X < p.Hitbox().Right) //Högerkollision { speed.X = -1; } else if (Hitbox().Left < p.Hitbox().Right&& Hitbox().Center.Y > p.Hitbox().Top) //Vänsterkollision { speed.X = 1; speed.Y = 1; } else { isOnGround = true; speed.Y = 0; base.HandleCollision(p); } }
public virtual void HandleCollision(GameObjects other) { hitBox.Y = other.hitBox.Y - hitBox.Height + 1; pos.Y = hitBox.Y; }
public virtual bool isColliding(GameObjects p) { return(hitBox.Intersects(p.hitBox)); }