public void MoveCloseToBall()
 {
     if (Math.Abs(ball.GetYposition() - cpuBar.YCenterOfBar()) > ProximityTolerance)
     {
         MoveCloserTo(ball.GetYposition());
     }
 }
Example #2
0
        private int OffCollision(Bar bar)
        {
            // That's some interesting bit, how should the ball bounce when colliding with the bar??
            // Let's make it simple: the further away from the middle of the bar, the least horizontally the ball will go
            var diff = yPosition - bar.YCenterOfBar();
            var off  = (diff) / 2;

            return(off);
        }
Example #3
0
 private int OffCollision(Bar bar)
 {
     // That's some interesting bit, how should the ball bounce when colliding with the bar??
     // Let's make it simple: the further away from the middle of the bar, the least horizontally the ball will go
     var diff = yPosition - bar.YCenterOfBar();
     var off = (diff) / 2;
     return off;
 }