Esempio n. 1
0
        void Level01Init()
        {
            SoundEffect sfMusic    = Content.Load <SoundEffect>("One Bullet OST Main Theme 180bpm");
            Texture2D   background = Content.Load <Texture2D>("Level01/FINAL");
            Texture2D   l1B1       = Content.Load <Texture2D>("Level01/Final_B1");
            Texture2D   l1B2       = Content.Load <Texture2D>("Level01/Final_B2");
            Texture2D   l1T1       = Content.Load <Texture2D>("Level01/Final_T1");
            Texture2D   l1T2       = Content.Load <Texture2D>("Level01/Final_T2");
            Texture2D   l1T3       = Content.Load <Texture2D>("Level01/Final_T3");
            Texture2D   l1T4       = Content.Load <Texture2D>("Level01/Final_T4");
            Texture2D   l1P1       = Content.Load <Texture2D>("Level01/Final_P1");
            Texture2D   l1P2       = Content.Load <Texture2D>("Level01/Final_P2");
            Texture2D   l1Floor    = Content.Load <Texture2D>("Level01/FINAL_Border_Bottom");
            Texture2D   l1Walls    = Content.Load <Texture2D>("Level01/FINAL_Border_Side");
            Texture2D   l1Ceiling  = Content.Load <Texture2D>("Level01/FINAL_Border_Top");

            Rectangle backgroundPos = new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight);

            Rectangle floorPlatPos = new Rectangle(0, (int)(GraphicsDevice.Viewport.Height * 0.95037), GraphicsDevice.Viewport.Width, (int)(GraphicsDevice.Viewport.Height * 0.04963));
            Platforms floorPlat    = new Platforms();

            floorPlat.Initialize(l1Floor, floorPlatPos);

            Rectangle ceilingPlatPos = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, (int)(GraphicsDevice.Viewport.Height * 0.0163));
            Platforms ceilingPlat    = new Platforms();

            ceilingPlat.Initialize(l1Ceiling, ceilingPlatPos);

            Rectangle rWallPlatPos = new Rectangle((int)(GraphicsDevice.Viewport.Width * 0.99104), 0, (int)(GraphicsDevice.Viewport.Width * 0.00813), GraphicsDevice.Viewport.Height);
            Platforms rWallPlat    = new Platforms();

            rWallPlat.Initialize(l1Walls, rWallPlatPos);

            Rectangle lWallPlatPos = new Rectangle(0, 0, (int)(GraphicsDevice.Viewport.Width * 0.00813), GraphicsDevice.Viewport.Height);
            Platforms lWallPlat    = new Platforms();

            lWallPlat.Initialize(l1Walls, lWallPlatPos);

            Rectangle l1B1Pos = new Rectangle(0, (int)(GraphicsDevice.Viewport.Height * 0.72556), (int)(GraphicsDevice.Viewport.Width * 0.16396), (int)(GraphicsDevice.Viewport.Height * 0.27444));
            Rectangle l1B2Pos = new Rectangle((int)(GraphicsDevice.Viewport.Width * 0.84175), (int)(GraphicsDevice.Viewport.Height * 0.72556), (int)(GraphicsDevice.Viewport.Width * 0.15813), (int)(GraphicsDevice.Viewport.Height * 0.27444));

            Platforms platB1 = new Platforms();
            Platforms platB2 = new Platforms();

            platB1.Initialize(l1B1, l1B1Pos);
            platB2.Initialize(l1B2, l1B2Pos);

            Rectangle l1T1Pos = new Rectangle(0, (int)(GraphicsDevice.Viewport.Height * 0.0037), (int)(GraphicsDevice.Viewport.Width * 0.14917), (int)(GraphicsDevice.Viewport.Height * 0.13111));
            Rectangle l1T2Pos = new Rectangle((int)(GraphicsDevice.Viewport.Width * 0.00542), (int)(GraphicsDevice.Viewport.Height * 0.13222), (int)(GraphicsDevice.Viewport.Width * 0.07375), (int)(GraphicsDevice.Viewport.Height * 0.14667));
            Rectangle l1T3Pos = new Rectangle((int)(GraphicsDevice.Viewport.Width * 0.84521), (int)(GraphicsDevice.Viewport.Height * 0.01185), (int)(GraphicsDevice.Viewport.Width * 0.15458), (int)(GraphicsDevice.Viewport.Height * 0.13185));
            Rectangle l1T4Pos = new Rectangle((int)(GraphicsDevice.Viewport.Width * 0.92521), (int)(GraphicsDevice.Viewport.Height * 0.1437), (int)(GraphicsDevice.Viewport.Width * 0.07479), (int)(GraphicsDevice.Viewport.Height * 0.12556));

            Platforms platT1 = new Platforms();
            Platforms platT2 = new Platforms();
            Platforms platT3 = new Platforms();
            Platforms platT4 = new Platforms();

            platT1.Initialize(l1T1, l1T1Pos);
            platT2.Initialize(l1T2, l1T2Pos);
            platT3.Initialize(l1T3, l1T3Pos);
            platT4.Initialize(l1T4, l1T4Pos);

            Rectangle l1P1Pos = new Rectangle((int)(GraphicsDevice.Viewport.Width * 0.47), (int)(GraphicsDevice.Viewport.Height * 0.73704), (int)(GraphicsDevice.Viewport.Width * 0.09188), (int)(GraphicsDevice.Viewport.Height * 0.03444));             // Bottom
            Rectangle l1P2Pos = new Rectangle((int)(GraphicsDevice.Viewport.Width * 0.24688), (int)(GraphicsDevice.Viewport.Height * 0.52556), (int)(GraphicsDevice.Viewport.Width * 0.14521), (int)(GraphicsDevice.Viewport.Height * 0.03519));          // Mid left
            Rectangle l1P3Pos = new Rectangle((int)(GraphicsDevice.Viewport.Width * 0.64354), (int)(GraphicsDevice.Viewport.Height * 0.52333), (int)(GraphicsDevice.Viewport.Width * 0.14521), (int)(GraphicsDevice.Viewport.Height * 0.03519));          // Mid Right
            Rectangle l1P4Pos = new Rectangle((int)(GraphicsDevice.Viewport.Width * 0.44354), (int)(GraphicsDevice.Viewport.Height * 0.31481), (int)(GraphicsDevice.Viewport.Width * 0.14521), (int)(GraphicsDevice.Viewport.Height * 0.03519));          // Top

            Platforms platP1 = new Platforms();
            Platforms platP2 = new Platforms();
            Platforms platP3 = new Platforms();
            Platforms platP4 = new Platforms();

            platP1.Initialize(l1P2, l1P1Pos);
            platP2.Initialize(l1P1, l1P2Pos);
            platP3.Initialize(l1P1, l1P3Pos);
            platP4.Initialize(l1P1, l1P4Pos);

            Platforms[] lvlPlats = { platB1, platB2, platT1, platT2, platT3, platT4, platP1, platP2, platP3, platP4 };

            SoundEffectInstance sfMusicInstance = sfMusic.CreateInstance();

            sfMusicInstance.IsLooped = true;

            level01.Initialize(background, backgroundPos, sfMusicInstance, 10, lvlPlats, floorPlat, ceilingPlat, rWallPlat, lWallPlat);
        }
Esempio n. 2
0
 public void Initialize(Texture2D bg, Rectangle bgPos, SoundEffectInstance musicSound, int pNum, Platforms[] lPlat, Platforms fPlat = null, Platforms cPlat = null, Platforms rWall = null, Platforms lWall = null)
 {
     background         = bg;
     backgroundPosition = bgPos;
     sfMusic            = musicSound;
     platNum            = pNum;
     lPlatforms         = new Platforms[platNum];
     lPlatforms         = lPlat;
     floor          = fPlat;
     ceiling        = cPlat;
     rightWall      = rWall;
     leftWall       = lWall;
     Level.curLevel = this;
     sfMusic.Play();
 }