예제 #1
0
파일: Player.cs 프로젝트: ferg060129/Toggle
        public Player(int xLocation, int yLocation, Inventory i, Game1 eng)
            : base(xLocation, yLocation)
        {
            animations.Add("idleDown",  new int[] { 0, 2 });
            animations.Add("idleUp",    new int[] { 1, 2 });
            animations.Add("idleRight", new int[] { 2, 2 });
            animations.Add("idleLeft",  new int[] { 3, 2 });
            animations.Add("moveDown",  new int[] { 4, 4 });
            animations.Add("moveUp",    new int[] { 5, 4 });
            animations.Add("moveRight", new int[] { 6, 2 });
            animations.Add("moveLeft",  new int[] { 7, 2 });
            goodGraphic = Textures.textures["protagsheet"];
            badGraphic = Textures.textures["protagsheet"];

            row = 7;
            imageBoundingRectangle = new Rectangle(32 * row, 32, 32, 32);

            width = 32;
            height = 32;
            velocity = 4;
            collidable = false;
            inventory = i;
            engine = eng;
            proportion = 0.5;
            hitByLaser = 10;
            dirtTracks = false;
        }
예제 #2
0
파일: Player.cs 프로젝트: ripark/Toggle
        public Player(int xLocation, int yLocation, bool initialState, Inventory i, Game1 eng)
            : base(xLocation, yLocation, initialState)
        {
            goodGraphic = Textures.textures["sprites"];
            badGraphic = Textures.textures["sprites"];

            row = 7;
            imageBoundingRectangle = new Rectangle(32 * row, 32, 32, 32);

            width = 32;
            height = 32;
            velocity = 4;
            collidable = false;
            inventory = i;
            engine = eng;
        }
예제 #3
0
파일: Game1.cs 프로젝트: ferg060129/Toggle
        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();
        }
예제 #4
0
파일: Game1.cs 프로젝트: ripark/Toggle
        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;
        }