Beispiel #1
0
 public Portrait(string saveString, string str)
 {
     this.sheet = sheetMan.getSheet("portrait");
     sendTime = TimePeriod.Past;
     wasMoved = false;
     parseString(saveString, str);
 }
Beispiel #2
0
 //present past constructor
 public Portrait(string saveString, TimePeriod period)
 {
     this.sheet = sheetMan.getSheet("portrait");
     wasMoved = false;
     if (period == TimePeriod.Present)
     {
         parseString(saveString, "EndPresentPortrait");
         wasMoved = true;
         inTime = TimePeriod.Present;
         sendTime = TimePeriod.Past;
     }
     else if (period == TimePeriod.Past)
     {
         parseString(saveString, "EndPastPortrait");
         wasMoved = true;
         inTime = TimePeriod.Past;
         sendTime = TimePeriod.Past;
     }
     else if (period == TimePeriod.FarPast)
     {
         parseString(saveString, "EndOldPortrait");
         sendTime = TimePeriod.FarPast;
         sheet = sheetMan.getSheet("oldportrait");
     }
 }
Beispiel #3
0
 public Stairs(float X, float Y, Direction direction, bool startIntact)
 {
     this.sheet = sheetMan.getSheet("stair");
     position = new Vector2(X, Y);
     intact = true;
     this.direction = direction;
     this.startIntact = startIntact;
 }
Beispiel #4
0
 public Floor(int X, int Y, int Width, int Height)
 {
     this.X = X;
     this.Y = Y;
     this.Width = Width;
     this.Height = Height;
     this.sheet = sheetMan.getSheet("floor");
 }
Beispiel #5
0
 public Wall(int X, int Y, int Width, int Height, bool startIntact)
 {
     this.X = X;
     this.Y = Y;
     this.Width = Width;
     this.Height = Height;
     this.sheet = sheetMan.getSheet("wall");
     this.startIntact = startIntact;
 }
Beispiel #6
0
 public ActionBubble()
 {
     this.sheet = sheetMan.getSheet("action");
     this.action = BubbleAction.None;
     visible = false;
     negated = false;
     if (sheet.hasAnimation("negate"))
     {
         negateInd = sheet.getAnimation("negate").First();
     }
 }
Beispiel #7
0
 public Boy(float X, float Y, ActionBubble actionBubble)
 {
     this.sheet = sheetMan.getSheet("boy");
     frame = 0;
     frameTime = 0;
     frameLength = 60;
     position = new Vector2(X, Y);
     Width = 38;
     Height = 58;
     state = BoyState.Idle;
     Animation = "stand";
     direction = Direction.Right;
     this.actionBubble = actionBubble;
     actionBubble.Player = this;
     actionBubble.show();
     teleportTo = new Vector2();
     drawLayer = DrawLayer.Player;
 }
Beispiel #8
0
 public Wall(string saveString)
 {
     this.sheet = sheetMan.getSheet("wall");
     string[] lines = saveString.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
     int lineNum = 0;
     X = 0;
     Y = 0;
     Width = 0;
     Height = 0;
     startIntact = true;
     string line = "";
     while (!line.StartsWith("EndWall") && lineNum < lines.Length)
     {
         line = lines[lineNum];
         if (line.StartsWith("x:"))
         {
             try { X = int.Parse(line.Substring(2)); }
             catch (FormatException) { }
         }
         if (line.StartsWith("y:"))
         {
             try { Y = int.Parse(line.Substring(2)); }
             catch (FormatException) { }
         }
         if (line.StartsWith("width:"))
         {
             try { Width = int.Parse(line.Substring(6)); }
             catch (FormatException) { }
         }
         if (line.StartsWith("height:"))
         {
             try { Height = int.Parse(line.Substring(7)); }
             catch (FormatException) { }
         }
         if (line.StartsWith("intact:"))
         {
             try { startIntact = bool.Parse(line.Substring(7)); }
             catch (FormatException) { }
         }
         lineNum++;
     }
 }
Beispiel #9
0
 public Stairs(string saveString)
 {
     this.sheet = sheetMan.getSheet("stair");
     X = 0;
     Y = 0;
     direction = Direction.Left;
     intact = true;
     startIntact = true;
     string[] lines = saveString.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
     int lineNum = 0;
     string line = "";
     while (!line.StartsWith("EndStair") && lineNum < lines.Length)
     {
         line = lines[lineNum];
         if (line.StartsWith("x:"))
         {
             try { X = int.Parse(line.Substring(2)); }
             catch (FormatException) { }
         }
         if (line.StartsWith("y:"))
         {
             try { Y = int.Parse(line.Substring(2)); }
             catch (FormatException) { }
         }
         if (line.StartsWith("direction:"))
         {
             string dir = line.Substring(10).Trim();
             if (dir == "Right")
                 direction = Direction.Right;
             else
                 direction = Direction.Left;
         }
         if (line.StartsWith("intact:"))
         {
             try { startIntact = bool.Parse(line.Substring(7)); }
             catch (FormatException) { }
         }
         lineNum++;
     }
 }
Beispiel #10
0
        protected void drawWallpaper(SpriteBatch spriteBatch, SpriteSheet wallpaper)
        {

            Effect paperEffect = null;
            if (control.timePeriod == TimePeriod.Past)
                paperEffect = greyScale;
            Matrix transform = Matrix.CreateScale(control.camera.scale);
            transform *= Matrix.CreateTranslation(-control.camera.X * control.camera.scale, -control.camera.Y * control.camera.scale, 0);

            Rectangle paperBounds = wallpaper.getSprite(0);
            Rectangle dest = new Rectangle(0,0, ScreenWidth/2, ScreenHeight/2);
            Color paperColor = control.level.wallpaperColor;
            if (control.timePeriod == TimePeriod.Past)
                paperColor.A = 16;
            int startX = -paperBounds.Width;
            int xCount = control.level.Width / paperBounds.Height + 2;
            int startY = (int)(Math.Floor((float)-control.camera.Y / paperBounds.Height)) * paperBounds.Height;
            int yCount = control.level.Height / paperBounds.Height + 1;
               // float minZ = (float)Math.Floor(ball.Z / 10) * 10.0f - 10;
            for (int drawX = 0; drawX < xCount; drawX++)
            {
                for (int drawY = 0; drawY < yCount; drawY++)
                {
                    Rectangle drawRect = new Rectangle(drawX * paperBounds.Width + startX, drawY * paperBounds.Height + startY, paperBounds.Width, paperBounds.Height);
                    Rectangle srcRect = new Rectangle(paperBounds.X, paperBounds.Y, paperBounds.Width, paperBounds.Height);
                    if ((drawY + 1) * paperBounds.Height + startY > control.level.Height)
                    {
                        drawRect.Height = control.level.Height - (drawY * paperBounds.Height + startY);
                        srcRect.Height = drawRect.Height;
                    }
                    spriteBatch.Draw(wallpaper.image, drawRect, srcRect, paperColor, 0f, new Vector2(),SpriteEffects.None, DrawLayer.Wallpaper);
                }
            }
            if (control.timePeriod == TimePeriod.Present)
            {
                paperBounds = wallpaper.getSprite(1);
                dest = new Rectangle(0, 0, ScreenWidth / 2, ScreenHeight / 2);
                for (int drawX = 0; drawX < xCount; drawX++)
                {
                    for (int drawY = 0; drawY < yCount; drawY++)
                    {
                        Rectangle drawRect = new Rectangle(drawX * paperBounds.Width + startX, drawY * paperBounds.Height + startY, paperBounds.Width, paperBounds.Height);
                        Rectangle srcRect = new Rectangle(paperBounds.X, paperBounds.Y, paperBounds.Width, paperBounds.Height);
                        if ((drawY + 1) * paperBounds.Height + startY > control.level.Height)
                        {
                            drawRect.Height = control.level.Height - (drawY * paperBounds.Height + startY);
                            srcRect.Height = drawRect.Height;
                        }
                        spriteBatch.Draw(wallpaper.image, drawRect, srcRect, Color.White, 0f, new Vector2(), SpriteEffects.None, DrawLayer.WallpaperTears);
                    }
                }
            }
        }
Beispiel #11
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 #12
0
 public Portrait(int x, int y)
 {
     position = new Vector2(x, y);
     this.sheet = sheetMan.getSheet("portrait");
 }
 public void addSheet(string name, SpriteSheet sheet)
 {
     if (!sheetDict.ContainsKey(name))
         sheetDict.Add(name, sheet);
 }