Example #1
0
        public override void Start()
        {
            base.Start();

            Vector2 screenCenter = new Vector2(Game.window.Width / 2, Game.window.Height / 2);

            GfxManager.Init();

            //GfxManager.AddTexture("bg", "Assets/bg_cartoon.jpg");

            GfxManager.AddTexture("bg0", "Assets/cyberpunk-street3.png");
            GfxManager.AddTexture("bg1", "Assets/cyberpunk-street2.png");
            GfxManager.AddTexture("bg2", "Assets/cyberpunk-street1.png");

            GfxManager.AddTexture("greenTank", "Assets/tanks_tankGreen_body1.png");
            GfxManager.AddTexture("tracks", "Assets/tanks_tankTracks1.png");
            GfxManager.AddTexture("turret", "Assets/tanks_turret2.png");

            GfxManager.AddTexture("bullet", "Assets/tank_bullet1.png");
            GfxManager.AddTexture("rocket", "Assets/tank_bullet3.png");
            GfxManager.AddTexture("crate", "Assets/crate.png");

            GfxManager.AddTexture("playerBar", "Assets/loadingBar_bar.png");
            GfxManager.AddTexture("barFrame", "Assets/loadingBar_frame.png");

            GfxManager.AddTexture("weapon_GUI_selection", "Assets/weapon_GUI_selection.png");
            GfxManager.AddTexture("weapons_GUI_frame", "Assets/weapons_GUI_frame.png");

            GfxManager.AddTexture("bullet_ico", "Assets/bullet_ico.png");
            GfxManager.AddTexture("missile_ico", "Assets/missile_ico.png");


            UpdateManager.Init();
            DrawManager.Init();
            PhysicsManager.Init();
            BulletManager.Init();
            //SpawnManager.Init();
            CameraManager.Init(screenCenter, screenCenter);
            CameraManager.AddCamera("bg0", 0.2f);
            CameraManager.AddCamera("bg1", 0.4f);
            //CameraManager.AddCamera("bg2", 0.8f);
            CameraManager.AddCamera("GUI", 0);

            playersName = new List <TextObject>();

            MinY = Game.window.Height - 20;

            FontManager.Init();
            FontManager.AddFont("stdFont", "Assets/textSheet.png", 15, 32, 20, 20);
            Font comics = FontManager.AddFont("comics", "Assets/comics.png", 10, 32, 61, 65);

            timer = new TextObject(new Vector2(Game.window.Width / 2, 60), "", comics, -20);

            Tile crate4 = new Tile(new Vector2(200, 400));
            Tile crate3 = new Tile(new Vector2(200, 300));
            Tile crate2 = new Tile(new Vector2(200, 200));
            Tile crate  = new Tile(new Vector2(200, 100));

            Tile crate1000 = new Tile(new Vector2(900, 200));
            Tile crate1001 = new Tile(new Vector2(830, 200));
            Tile crate1002 = new Tile(new Vector2(760, 200));
            Tile crate1003 = new Tile(new Vector2(690, 200));
            Tile crate1004 = new Tile(new Vector2(620, 200));

            players    = new List <Player>();
            weaponsGUI = new List <WeaponsGUI>();

            for (int i = 0; i < 2; i++)
            {
                CreatePlayer(i);
            }

            CurrentPlayer      = players[0];
            currentPlayerIndex = 0;
            CurrentPlayer.Play();

            bg_far = new Background("bg0", new Vector2(-640, -60), 0);
            bg_far.SetCamera(CameraManager.GetCamera("bg0"));

            bg_medium = new Background("bg1", new Vector2(-640, 0), 0);
            bg_medium.SetCamera(CameraManager.GetCamera("bg1"));

            bg_near = new Background("bg2", new Vector2(-640, 0), 0);
            //bg_near.SetCamera(CameraManager.GetCamera("bg2"));

            CameraManager.SetTarget(CurrentPlayer);
        }