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

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

            GfxManager.Load();

            UpdateManager.Init();
            DrawManager.Init();
            PhysicsManager.Init();
            BulletManager.Init();
            CameraManager.Init(screenCenter, screenCenter);
            CameraManager.AddCamera("bg", 0.2f);

            CameraManager.AddCamera("GUI", 0);

            playersName = new List <TextObject>();

            MinY = Game.window.Height - 25;


            AudioManager.Load();



            FontManager.Init();
            FontManager.AddFont("stdFont", "Assets/textSheet.png", 15, 32, 20, 20);
            FontManager.AddFont("comics", "Assets/comics.png", 10, 32, 61, 65);
            timer = new Timer();
            Vector2 positionFrame = new Vector2(50, 550);
            Vector2 bulletFrame   = new Vector2(82, 550);

            GfxManager.LoadTiledMap("Assets/Map/map_lv1.tmx");

            players = new List <Player>();

            Player player1 = new Player("playerTank", new Vector2(Game.window.Width / 2 + 250 + space, 10));

            playersName.Add(new TextObject(new Vector2(50, 20), "player 1"));
            players.Add(player1);

            Player player2 = new Player("enemyTank", new Vector2(200, 20), 1);

            playersName.Add(new TextObject(new Vector2(50 + 250, 20), "player 2"));
            players.Add(player2);

            CurrentPlayer      = player1;
            currentPlayerIndex = 0;
            CurrentPlayer.Play();
            //controllorare se inseguito da errori

            bg_far = new Background("bg", new Vector2(0, 0), 0);
            bg_far.SetCamera(CameraManager.GetCamera("bg0"));
            weaponsGUI = new List <WeaponsGUI>();


            CameraManager.SetTarget(player1);
        }
示例#2
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);
        }