Esempio n. 1
0
        private void InitializeBackground()
        {
            TiledSprite borderBackground = new TiledSprite(LEVEL_WIDTH * ROOM_WIDTH * BLOCK_WIDTH * 2, LEVEL_HEIGHT * ROOM_HEIGHT * BLOCK_HEIGHT * 2);
            borderBackground.LoadTexture("level/borderTile");
            borderBackground.Position = new Vector2(-Controller.LevelBorderSize.X, -Controller.LevelBorderSize.Y);

            this.AddChild(borderBackground);

            TiledSprite levelBackground = new TiledSprite(LEVEL_WIDTH * ROOM_WIDTH * BLOCK_WIDTH, LEVEL_HEIGHT * ROOM_HEIGHT * BLOCK_HEIGHT);
            levelBackground.LoadTexture("level/levelTile");

            this.AddChild(levelBackground);
        }
Esempio n. 2
0
        public GameState()
        {
            this.BigText = new Label("Player 1 is out", Controller.FontController.GetFont("bigFont"));
            this.BigText.HorizontalAlign = HorizontalAlign.CENTER;
            this.BigText.Visable = false;
            this.BigText.Width = 1800;
            this.BigText.Height = 1000;

            Controller.LayerController.AddLayer("bombLayer");
            FatBomb.state = this;
            Vetbol.state = this;
            CapturePoint.state = this;
            TiledSprite bg = new TiledSprite(2000, 2000);

            bg.LoadTexture("background");
            bg.Depth = 0f;

            tilemap = new Tilemap();
            tilemap.LoadMap("Content/testmap.tmx", 32, 32);
            this.AddChild(bg);
            this.AddChild(tilemap);

            this.players = new List<Vetbol>();

            playerSpawn = tilemap.RemoveTiles(7);
            int playerRespawn = rnd.Next(playerSpawn.Count);

            List<Tile> capturePointTiles = tilemap.RemoveTiles(3);
            foreach (Tile tile in capturePointTiles)
            {
                CapturePoint capturepoint = new CapturePoint();
                capturepoint.Position = tile.Position + ( new Vector2(-27, -61));
                capturePoints.Add(capturepoint);
                AddChild(capturepoint);
            }

            NotUsedSpawnPoints = new List<Tile>();
            NotUsedSpawnPoints.AddRange(playerSpawn);

            for (int i = 0; i < Controller.Input.getPadStateList.Where(c => c.IsConnected).Count(); i++)
            {
                this.players.Add(new Vetbol((PlayerIndex)i));
            }

            for (int j = 0; j < players.Count; j++)
            {
                this.players[j].score = playerStartScore;
                this.players[j].Position = this.getAvailablePosition();
                this.AddChild(this.players[j]);
            }
            lastPlayerAlive = players[0];

            this.BombPool = new Pool<FatBomb>(50, false, FatBomb.IsValid, this.NewBomb);

            soundEffectBomb = Controller.Content.Load<SoundEffect>("sounds/explode");

            this.AddChild(this.BigText);

            this.hud = new HUD(this.players, respawnTime);
            this.AddChild(hud);

            deadSound = Controller.Content.Load<SoundEffect>("sounds/dead");
            ECGsound = Controller.Content.Load<SoundEffect>("sounds/ecg");
        }