Beispiel #1
0
        public void HandleCollisionWithPlayer(Ball ball, Player player)
        {
            Vector2 v = ball.Velocity;

            if (ball.Position.X + ball.Size.X >= player.Position.X && ball.Position.Y < player.Position.Y)
                v = new Vector2(-ball.Velocity.X, ball.Velocity.Y);

            ball.Velocity = v;
        }
Beispiel #2
0
 public Team(PlayerType type, GEnvironment environment)
 {
     _players = new List<Player>();
     _environment = environment;
     for (int i = 0; i < TEAM_SIZE; i++)
     {
         Player player = new Player(type);
         _players.Add(player);
         _environment.RegisterEntity(player);
     }
     _playerType = type;
 }