Exemple #1
0
        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);
            }
        }