Exemplo n.º 1
0
        public DanceScreen(Game1 eng, Player p)
        {
            engine = eng;
            screenWidth = engine.getScreenWidth();
            screenHeight = engine.getScreenWidth();

            if(screenWidth < 800)
            {
                screenWidth = 800;
            }
            tiles = new Tile[screenWidth / 32, screenHeight / 32];
            for (int x = 0; x < tiles.GetLength(0); x++ )
            {
                for(int y = 0; y < tiles.GetLength(1); y++ )
                {

                    int temp = rand.Next(3);
                    tiles[x,y] = new Tile(temp,x,y);
                }
            }
            makePoints();
            addPointOffset();
            player = p;
        }
Exemplo n.º 2
0
        protected override void LoadContent()
        {
            startButton = Content.Load<Texture2D>(@"start");
            exitButton = Content.Load<Texture2D>(@"exit");

            width = GraphicsDevice.PresentationParameters.Bounds.Width;
            height = GraphicsDevice.PresentationParameters.Bounds.Height;
            screenWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //Associate names in the dictionary with the graphics
            for (int x = 0; x < Textures.graphicNames.Length; x++)
            {
                Textures.textures.Add(Textures.graphicNames[x], Content.Load<Texture2D>(Textures.graphicNames[x]));
            }

            for (int x = 0; x < Textures.tileNames.Length; x++)
            {
                Textures.textures.Add(Textures.tileNames[x], Content.Load<Texture2D>("Tile/" + Textures.tileNames[x]));
            }
            screenDisplayed = Textures.textures["titleScreen3"];
            for (int x = 0; x < Textures.spritefonts.Length; x++)
            {
                Textures.fonts.Add(Textures.spritefonts[x], Content.Load<SpriteFont>(Textures.spritefonts[x]));
            }

            for (int x = 0; x < Textures.soundsNames.Length; x++)
            {
                Textures.sounds.Add(Textures.soundsNames[x], Content.Load<SoundEffect>(Textures.soundsNames[x]).CreateInstance());
            }

            levels.Add(tutorialLevel = new TutorialLevel());
            levels.Add(hubLevel = new HubLevel());
            levels.Add(houseLevel = new HouseLevel());
            levels.Add(schoolLevel = new SchoolLevel());
            levels.Add(gateLevel = new GateLevel());
            levels.Add(gate1Level = new Gate1Level());
            levels.Add(gate2Level = new Gate2Level());
            levels.Add(complex1Level = new Complex1());
            levels.Add(ghostTestLevel = new GhostTestLevel());
            levels.Add(laserTestLevel = new LaserTestLevel());
            levels.Add(laserIntroLevel = new LaserIntro());
            levels.Add(marshEnterLevel = new MarshEnterLevel());
            levels.Add(marsh1Level = new Marsh1Level());
            levels.Add(marsh2Level = new Marsh2Level());
            levels.Add(marshFinalLevel = new MarshFinalLevel());

            //normal is hubLevel, change only to test
            currentLevel = hubLevel;

            stringToLevel.Add("hubLevel", hubLevel);
            stringToLevel.Add("houseLevel", houseLevel);
            stringToLevel.Add("schoolLevel", schoolLevel);
            stringToLevel.Add("gateLevel", gateLevel);
            stringToLevel.Add("gate1Level", gate1Level);
            stringToLevel.Add("gate2Level", gate2Level);
            stringToLevel.Add("complex1Level", complex1Level);
            stringToLevel.Add("ghostTestLevel", ghostTestLevel);
            stringToLevel.Add("laserTestLevel", laserTestLevel);
            stringToLevel.Add("laserIntroLevel", laserIntroLevel);
            stringToLevel.Add("marshEnterLevel", marshEnterLevel);
            stringToLevel.Add("marsh1Level", marsh1Level);
            stringToLevel.Add("marsh2Level", marsh2Level);
            stringToLevel.Add("marshFinalLevel", marshFinalLevel);
            stringToLevel.Add("tutorialLevel", tutorialLevel);

            levelToString.Add(hubLevel, "hubLevel");
            levelToString.Add(houseLevel, "houseLevel");
            levelToString.Add(schoolLevel, "schoolLevel");
            levelToString.Add(gateLevel, "gateLevel");
            levelToString.Add(gate1Level, "gate1Level");
            levelToString.Add(gate2Level, "gate2Level");
            levelToString.Add(complex1Level, "complex1Level");
            levelToString.Add(ghostTestLevel, "ghostTestLevel");
            levelToString.Add(laserTestLevel, "laserTestLevel");
            levelToString.Add(laserIntroLevel, "laserIntroLevel");
            levelToString.Add(marshEnterLevel, "marshEnterLevel");
            levelToString.Add(marsh1Level, "marsh1Level");
            levelToString.Add(marsh2Level, "marsh2Level");
            levelToString.Add(marshFinalLevel, "marshFinalLevel");
            levelToString.Add(tutorialLevel, "tutorialLevel");
            //normal is hubLevel, change only to test
            // currentLevel = marshFinalLevel;
            currentLevel = hubLevel;
            inventory = new Inventory(this);
            //13 x 25 for hub level start
            //beep = Content.Load<SoundEffect>("beep").CreateInstance();
            //player = new Player(5 * 32, 32 * 5, inventory, this);
            //hub start
            player = new Player(13 * 32, 25 * 32, inventory, this);

            playerGhost = new PlayerGhost(0, 0);

            roseExpositionScreen = new RoseExpositionScreen(this);
            openingExpositionScreen = new OpeningExpositionScreen(this);
            knifeExpositionScreen = new KnifeExpositionScreen(this);
            diaryExpositionScreen = new DiaryExpositionScreen(this);
            platformScreen = new PlatformScreen(this);
            shiftLockScreen = new ShiftLockScreen(this);
            inventoryScreen = new InventoryScreen(this);
            startScreen = new StartScreen(this);
            aboutScreen = new AboutScreen(this);
            danceScreen = new DanceScreen(this, player);
            pauseScreen = new PauseScreen(this);
            deadScreen = new DeadScreen(this);
            //player = new Player(15*32, 2*32, inventory, this);
            //player = new Player(30 * 32, 9 * 32, inventory, this);
            cam = new Camera(player, width, height);
            creatures.Add(player);
            cam.update();

            //song = Content.Load<Song>("banditKing2");

            //SoundEffect banditKing_s = Content.Load<SoundEffect>("banditKing2");
            //banditKing = banditKing_s.CreateInstance();

            zone1good = Content.Load<SoundEffect>("zone4good").CreateInstance();
            zone1bad = Content.Load<SoundEffect>("zone4bad").CreateInstance();

            //banditKing.Pitch = -1;

            //song2 = Content.Load<Song>("climbing_up_the_walls");

            currentLevel.loadLevel();
            //add level transfer tiles from current level to the array list of tiles
            tiles.AddRange(currentLevel.getLevelTiles());
            levelTiles.AddRange(currentLevel.getLevelTiles());
            cam.setBounds(currentLevel.getMapSizeX(), currentLevel.getMapSizeY());

            //MediaPlayer.Play(song);
            //banditKing.Play();

            gameState = "start";
            //Check whether there is a continue point
            continueButtonActive = saveFileExists();
            //MediaPlayer.IsRepeating = true;
            zone1good.Volume = .7f;
            zone1bad.Volume = 0;

            backUpInventory = inventory.getItemsCopy();
            backUpItems = (ArrayList)(currentLevel.getLevelItems()).Clone();
            backUpPlatformFilled = new bool[2];
            if (currentLevel.Equals(hubLevel))
                loadBackupPlatforms();
        }
Exemplo n.º 3
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //Associate names in the dictionary with the graphics
            for (int x = 0; x < Textures.graphicNames.Length; x++)
            {
                Textures.textures.Add(Textures.graphicNames[x], Content.Load<Texture2D>(Textures.graphicNames[x]));
            }

            KittenZombie kt = new KittenZombie(400,300,worldState);
            FlowerTentacles ft = new FlowerTentacles(600, 250, worldState);
            //creatures.Add(kt);
            for (int i = 0; i < 5; i++ )
            {
                for (int y2 = 0; y2 < 5; y2++)
                {
                    kt = new KittenZombie(i * 35, 5 + (y2 * 35), worldState);
                    ft = new FlowerTentacles(5 + (i * 35),(y2 * 35) + 230, worldState);
                    creatures.Add(kt);
                    creatures.Add(ft);
                }
            }
            player = new Player(700, 300, worldState);
            creatures.Add(player);

            /*FlowerTentacles ft = new FlowerTentacles(600, 250, worldState);
            creatures.Add(ft);

            ft = new FlowerTentacles(300, 350, worldState);
            creatures.Add(ft);*/

            GreenBlock b = new GreenBlock(250, 300, worldState);
            items.Add(b);

            song = Content.Load<Song>("whitesky");
            song2 = Content.Load<Song>("climbing_up_the_walls");
            MediaPlayer.Play(song);
            //MediaPlayer.IsRepeating = true;
        }
Exemplo n.º 4
0
        protected override void LoadContent()
        {
            width = GraphicsDevice.PresentationParameters.Bounds.Width;
            height = GraphicsDevice.PresentationParameters.Bounds.Height;
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //Associate names in the dictionary with the graphics
            for (int x = 0; x < Textures.graphicNames.Length; x++)
            {
                Textures.textures.Add(Textures.graphicNames[x], Content.Load<Texture2D>(Textures.graphicNames[x]));
            }

            for(int x = 0; x < Textures.tileNames.Length; x++)
            {
                Textures.textures.Add(Textures.tileNames[x], Content.Load<Texture2D>("Tile/" + Textures.tileNames[x]));
            }

            //KittenZombie kt = new KittenZombie(400,300,worldState);
            //FlowerTentacles ft = new FlowerTentacles(600, 250, worldState);
            //creatures.Add(kt);
            /*
            for (int i = 0; i < 5; i++ )
            {
                for (int y2 = 0; y2 < 5; y2++)
                {
                    kt = new KittenZombie(i * 35, 5 + (y2 * 35), worldState);
                    ft = new FlowerTentacles(5 + (i * 35),(y2 * 35) + 230, worldState);
                    creatures.Add(kt);
                    creatures.Add(ft);
                }
            }
             * */
            inventory = new Inventory(300, 300);
            player = new Player(32*19, 32*5, worldState, inventory, this);
            creatures.Add(player);

            FlowerTentacles ft = new FlowerTentacles(32*11, 32*4, worldState);
            creatures.Add(ft);
            ft.setDefendTileGood(11, 4);
            ft.setDefendTileBad(11, 7);

            ft = new FlowerTentacles(32 * 12, 32 * 4, worldState);
            creatures.Add(ft);
            ft.setDefendTileGood(12, 4);
            ft.setDefendTileBad(12, 6);

            ft = new FlowerTentacles(32 * 12, 32 * 11, worldState);
            creatures.Add(ft);
            ft.setDefendTileGood(12, 11);
            ft.setDefendTileBad(13, 7);

            ft = new FlowerTentacles(32 * 11, 32 * 11, worldState);
            creatures.Add(ft);
            ft.setDefendTileGood(11, 11);
            ft.setDefendTileBad(12, 8);

            //ft = new FlowerTentacles(500, 400, worldState);
            //creatures.Add(ft);

            GreenBlock b = new GreenBlock(32*12, 32*7, worldState);
            items.Add(b);

            song = Content.Load<Song>("whitesky");
            song2 = Content.Load<Song>("climbing_up_the_walls");

            MediaPlayer.Play(song);
            makeMapFromFile("home.txt");
            //MediaPlayer.IsRepeating = true;
        }