Server.Player.treatCollision C# (CSharp) Méthode

treatCollision() public méthode

In case a collison is detected, this function should be called to treat how a player instance will respond in collison with another object
public treatCollision ( Player object2 ) : void
object2 Player An instance to a player
Résultat void
        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);
        }

Same methods

Player::treatCollision ( Planets object2 ) : void