Beispiel #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            control.state = paranothing.GameState.MainMenu;

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            spriteBatch2 = new SpriteBatch(GraphicsDevice);

            //Stuff for fade
            stopwatch = new Stopwatch();
            white = Content.Load<Texture2D>("white");

            audioEngine = new AudioEngine(@"Content/Sounds/sounds.xgs");
            waveBank = new WaveBank(audioEngine, @"Content/Sounds/Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, @"Content/Sounds/Sound Bank.xsb");
            soundMan.setSoundBank(ref soundBank);
            bgMusic = Content.Load<Song>("Sounds/Soundtrack");
            MediaPlayer.Play(bgMusic);
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume = 0.1f;

            greyScale = Content.Load<Effect>("Greyscale");

            wallpaperTex = Content.Load<Texture2D>("Sprites/Wallpaper");
            wallpaperSheet = new SpriteSheet(wallpaperTex);
            wallpaperSheet.splitSheet(1, 2);

            wardrobeTex = Content.Load<Texture2D>("Sprites/wardrobe");
            wardrobeSheet = new SpriteSheet(wardrobeTex);
            wardrobeSheet.splitSheet(1, 5);
            wardrobeSheet.addAnimation("wardrobeclosed", new int[] { 0 });
            wardrobeSheet.addAnimation("wardrobeopening", new int[] { 1, 2, 3 });
            wardrobeSheet.addAnimation("wardrobeopen", new int[] { 4 });

            //Portrait
            portraitTex = Content.Load<Texture2D>("Sprites/portrait");
            portraitSheet = new SpriteSheet(portraitTex);
            portraitSheet.splitSheet(2, 1);

            rubbleTex = Content.Load<Texture2D>("Sprites/rubble");
            rubbleSheet = new SpriteSheet(rubbleTex);
            rubbleSheet.addSprite(0, 0, 37, 28);

            actionTex = Content.Load<Texture2D>("Sprites/actions");
            actionSheet = new SpriteSheet(actionTex);
            actionSheet.splitSheet(3, 3);
            actionSheet.addAnimation("bubble", new int[] { 0 });
            actionSheet.addAnimation("wardrobe", new int[] { 1 });
            actionSheet.addAnimation("push", new int[] { 2 });
            actionSheet.addAnimation("chair", new int[] { 3 });
            actionSheet.addAnimation("stair", new int[] { 4 });
            actionSheet.addAnimation("portrait", new int[] { 5 });
            actionSheet.addAnimation("oldportrait", new int[] { 6 });
            actionSheet.addAnimation("bookcase", new int[] { 7 });
            actionSheet.addAnimation("negate", new int[] { 8 });

            boyTex = Content.Load<Texture2D>("Sprites/BruceSheet");
            boySheet = new SpriteSheet(boyTex);
            boySheet.splitSheet(7, 9, 0, 0, 58);
            boySheet.addAnimation("walk", new int[] { 0, 1, 2, 3, 4, 5, 6, 7 });
            boySheet.addAnimation("stand", new int[] { 8 });
            boySheet.addAnimation("leavewardrobe", new int[] { 9, 10, 11, 12, 13, 14, 15, 16 });
            boySheet.addAnimation("enterwardrobe", new int[] { 18, 19, 20, 21, 22, 23, 24, 25 });
            boySheet.addAnimation("enterportrait", new int[] { 27, 28, 29, 30, 31, 32, 33, 34 });
            boySheet.addAnimation("leaveportrait", new int[] { 34, 33, 32, 31, 30, 29, 28, 27 });
            boySheet.addAnimation("startpush", new int[] { 36, 37, 38, 39 });
            boySheet.addAnimation("endpush", new int[] { 39, 38, 37, 36 });
            boySheet.addAnimation("push", new int[] { 41, 42, 43, 44, 45, 46, 47, 48 });
            boySheet.addAnimation("pushstill", new int[] { 49 });
            boySheet.addAnimation("controlstart", new int[] { 50, 51, 52 });
            boySheet.addAnimation("control", new int[] { 53 });
            boySheet.addAnimation("controlend", new int[] { 52, 51, 50 });
            boySheet.addAnimation("disappear", new int[] { 50, 51, 52, 53, 54, 55, 56, 57 });

            shadowTex = Content.Load<Texture2D>("Sprites/Shadow");
            shadowSheet = new SpriteSheet(shadowTex);
            shadowSheet.splitSheet(1, 4);
            shadowSheet.addAnimation("walk", new int[] { 0, 1, 2 });
            shadowSheet.addAnimation("stopwalk", new int[] { 2, 1, 0 });
            shadowSheet.addAnimation("stand", new int[] { 3 });

            floorTex = Content.Load<Texture2D>("Sprites/floor");
            floorSheet = new SpriteSheet(floorTex);
            floorSheet.splitSheet(2, 1);

            wallTex = Content.Load<Texture2D>("Sprites/wall");
            wallSheet = new SpriteSheet(wallTex);
            wallSheet.splitSheet(1, 2);

            stairTex = Content.Load<Texture2D>("Sprites/Staircase");
            stairSheet = new SpriteSheet(stairTex);
            stairSheet.splitSheet(1, 2);

            doorTex = Content.Load<Texture2D>("Sprites/door");
            doorSheet = new SpriteSheet(doorTex);
            doorSheet.splitSheet(2, 3);
            doorSheet.addAnimation("doorclosedpast", new int[] { 0 });
            doorSheet.addAnimation("dooropeningpast", new int[] { 1 });
            doorSheet.addAnimation("dooropenpast", new int[] { 2 });
            doorSheet.addAnimation("doorclosedpresent", new int[] { 3 });
            doorSheet.addAnimation("dooropeningpresent", new int[] { 4 });
            doorSheet.addAnimation("dooropenpresent", new int[] { 5 });

            //Old Portrait
            oldPortraitTex = Content.Load<Texture2D>("Sprites/PortraitWoman");
            oldPortraitSheet = new SpriteSheet(oldPortraitTex);
            oldPortraitSheet.splitSheet(2, 1);

            keyTex = Content.Load<Texture2D>("Sprites/Key");
            keySheet = new SpriteSheet(keyTex);
            keySheet.splitSheet(2, 1);

            chairTex = Content.Load<Texture2D>("Sprites/chair");
            chairSheet = new SpriteSheet(chairTex);
            chairSheet.splitSheet(1, 2);

            finalDoorTex = Content.Load<Texture2D>("Sprites/door_final");
            finalDoorSheet = new SpriteSheet(finalDoorTex);
            finalDoorSheet.splitSheet(1, 7);
            finalDoorSheet.addAnimation("bookcaseclosed", new int[] { 0 });
            finalDoorSheet.addAnimation("bookcaseopening", new int[] { 1, 2, 3, 4, 5 });
            finalDoorSheet.addAnimation("bookcaseclosing", new int[] { 5, 4, 3, 2, 1 });
            finalDoorSheet.addAnimation("bookcaseopen", new int[] { 6 });

            buttonTex = Content.Load<Texture2D>("Sprites/button");
            buttonSheet = new SpriteSheet(buttonTex);
            buttonSheet.splitSheet(1, 2);

            sheetMan.addSheet("wallpaper", wallpaperSheet);
            sheetMan.addSheet("wardrobe", wardrobeSheet);
            sheetMan.addSheet("portrait", portraitSheet);
            sheetMan.addSheet("rubble", rubbleSheet);
            sheetMan.addSheet("action", actionSheet);
            sheetMan.addSheet("boy", boySheet);
            sheetMan.addSheet("floor", floorSheet);
            sheetMan.addSheet("wall", wallSheet);
            sheetMan.addSheet("stair", stairSheet);
            sheetMan.addSheet("door", doorSheet);
            sheetMan.addSheet("oldportrait", oldPortraitSheet);
            sheetMan.addSheet("key", keySheet);
            sheetMan.addSheet("chair", chairSheet);
            sheetMan.addSheet("bookcase", finalDoorSheet);
            sheetMan.addSheet("button", buttonSheet);
            sheetMan.addSheet("shadow", shadowSheet);

            actionBubble = new ActionBubble();
            player = new Boy(254, 240, actionBubble);
            Camera camera = new Camera(0, 360, 1280, 720, 2.0f);
            tutorial = new Level("levels/tutorial.lvl");
            level1 = new Level("levels/level1.lvl");
            level2 = new Level("levels/level2.lvl");
            level3 = new Level("levels/level3.lvl");
            level4 = new Level("levels/level4.lvl");
            control.addLevel(tutorial);
            control.addLevel(level1);
            control.addLevel(level2);
            control.addLevel(level3);
            control.addLevel(level4);
            control.goToLevel("Tutorial");

            GameTitle.levelName = "Tutorial";

            control.setPlayer(player);
            control.setCamera(camera);
            control.initLevel(false);

            controller = Content.Load<Texture2D>("controller");

            // TODO: use this.Content to load your game content here
            loadTitleContents();
            description = new GameBackground(Content.Load<Texture2D>("GameThumbnail"), new Rectangle(0, 0, (int)(ScreenWidth), (int)(ScreenHeight)));
        }
Beispiel #2
0
        public void ResetGame()
        {
            gameInProgress = false;
            
            actionBubble = new ActionBubble();
            player = new Boy(254, 240, actionBubble);
            //control.goToLevel("Tutorial");

            //GameTitle.levelName = "Tutorial";

            Camera camera = new Camera(0, 360, 1280, 720, 2.0f);

            //control.level = l;
            control.setPlayer(player);
            control.setCamera(camera);
            control.initLevel(false);

            //loadTitleContents();
            description = new GameBackground(Content.Load<Texture2D>("GameThumbnail"), new Rectangle(0, 0, (int)(ScreenWidth), (int)(ScreenHeight)));

            fadeOpacity = 0;

        }
 public void setCamera(Camera camera)
 {
     this.camera = camera;
     addObject(camera);
 }