public void treatCollision(Player object2)
{
//Give object that is being collided with the same speed but add the colliders speed to it to simulate a bounce.
object2.speedX = object2.speedX + (this.speedX * (float)(0.8));
object2.speedY = object2.speedY + (this.speedY * (float)(0.8));
//make the colliders' speed the reverse because of collision.
this.speedX = this.speedX * (float)(-0.25);
this.speedY = this.speedY * (float)(-0.25);
}