public BallView(BallModel ball, Texture2D sprite)
        {
            this.ball = ball;
              this.sprite = sprite;

              ballTrails = new List<Vector2>();
              maxTrails = 10;
              lastTrailTime = TimeSpan.Zero;
              trailRecordRate = TimeSpan.FromMilliseconds(200f);
        }
Exemple #2
0
        public World()
        {
            // Object Instantiation
              random = new Random();
              player1 = new PlayerModel(this, new Vector2(100, 100), 100, 100);
              ball = new BallModel(this, 200, 200, 10, 10);

              Vector2 randomDirection = new Vector2(
            (float)(random.NextDouble() * (random.NextDouble() * 2 - 1)),
            (float)(random.NextDouble() * (random.NextDouble() * 2 - 1))
            );

              ball.setInitialDirection(randomDirection);

              int w = 64, h = 64, space = 1;

              tiles.Add(new TileModel(this, (w + space) * 0, (h + space) * 0, w, h));
              tiles.Add(new TileModel(this, (w + space) * 1, (h + space) * 0, w, h));
              tiles.Add(new TileModel(this, (w + space) * 2, (h + space) * 0, w, h));
              tiles.Add(new TileModel(this, (w + space) * 3, (h + space) * 0, w, h));
        }
Exemple #3
0
        public World()
        {
            // Object Instantiation
            random  = new Random();
            player1 = new PlayerModel(this, new Vector2(100, 100), 100, 100);
            ball    = new BallModel(this, 200, 200, 10, 10);

            Vector2 randomDirection = new Vector2(
                (float)(random.NextDouble() * (random.NextDouble() * 2 - 1)),
                (float)(random.NextDouble() * (random.NextDouble() * 2 - 1))
                );

            ball.setInitialDirection(randomDirection);

            int w = 64, h = 64, space = 1;

            tiles.Add(new TileModel(this, (w + space) * 0, (h + space) * 0, w, h));
            tiles.Add(new TileModel(this, (w + space) * 1, (h + space) * 0, w, h));
            tiles.Add(new TileModel(this, (w + space) * 2, (h + space) * 0, w, h));
            tiles.Add(new TileModel(this, (w + space) * 3, (h + space) * 0, w, h));
        }