Exemple #1
0
        public bool Update(Angel angel, List<Wall> walls, List<Link> links)
        {
            Vector2 direction = new Vector2(angel.hitBox.X - position.X, angel.hitBox.Y - position.Y);
            float angleTo = (float)Math.Acos(direction.X / direction.Length());
            if (direction.Y < 0)
                angleTo *= -1;

            if (angleTo < 0)
                angleTo += MathHelper.TwoPi;
            else if (angleTo >= MathHelper.TwoPi)
                angleTo -= MathHelper.TwoPi;
            if (angle < 0)
                angle += MathHelper.TwoPi;
            else if (angle >= MathHelper.TwoPi)
                angle -= MathHelper.TwoPi;

            if (angleTo > angle)
                if (angleTo - angle < MathHelper.Pi)
                    angle += 0.04f;
                else
                    angle -= 0.04f;
            else
                if (angle - angleTo > MathHelper.Pi)
                    angle += 0.04f;
                else
                    angle -= 0.04f;

            motion = new Vector2((float)Math.Cos(angle) * 8, (float)Math.Sin(angle) * 8);
            position += motion;
            hitBox.X = (int)position.X;
            hitBox.Y = (int)position.Y;

            for (int i = 0; i < trail.Count; i++)
                if (trail[i].Update())
                    trail.RemoveAt(i);
            trail.Insert(0, new TrailPiece(10, position, trailTexture));
            if (hitBox.Intersects(angel.hitBox))
                return true;
            foreach (Wall w in walls)
                if (hitBox.Intersects(w.hitBox))
                    return true;
            foreach (Link w in links)
                if (hitBox.Intersects(w.hitBox))
                    return true;

            return false;
        }
        public bool Update(Angel angel, List<Wall> walls, List<Link> links, SoundEffect rocketLaunch)
        {
            Vector2 direction = new Vector2(angel.hitBox.X - hitBox.X, angel.hitBox.Y - hitBox.Y);
            angle = (float)Math.Acos(direction.X / direction.Length());
            if (direction.Y < 0)
                angle *= -1;

            if (pause != pauseTime)
                pause++;
            else
            {
                rocketLaunch.Play(0.4F, 0.0F, 0.0F);
                rocket.position.X = hitBox.X + 8;
                rocket.position.Y = hitBox.Y + 16;
                rocket.angle = angle;
                pause++;
            }
            return rocket.Update(angel, walls, links);
        }
        public bool Update(Angel angel, List <Wall> walls, List <Link> links, SoundEffect rocketLaunch)
        {
            Vector2 direction = new Vector2(angel.hitBox.X - hitBox.X, angel.hitBox.Y - hitBox.Y);

            angle = (float)Math.Acos(direction.X / direction.Length());
            if (direction.Y < 0)
            {
                angle *= -1;
            }

            if (pause != pauseTime)
            {
                pause++;
            }
            else
            {
                rocketLaunch.Play(0.4F, 0.0F, 0.0F);
                rocket.position.X = hitBox.X + 8;
                rocket.position.Y = hitBox.Y + 16;
                rocket.angle      = angle;
                pause++;
            }
            return(rocket.Update(angel, walls, links));
        }
Exemple #4
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font        = Content.Load <SpriteFont>("font");

            // Load sprites
            angelNormal[0] = Content.Load <Texture2D>("angel/angel normal 1");
            angelNormal[1] = Content.Load <Texture2D>("angel/angel normal 2");
            angelFly[0]    = Content.Load <Texture2D>("angel/angel fly 1");
            angelFly[1]    = Content.Load <Texture2D>("angel/angel fly 2");
            angelFly[2]    = Content.Load <Texture2D>("angel/angel fly 3");

            catNormal[0] = catNormal[6] = Content.Load <Texture2D>("cat/cat normal 1");
            catNormal[1] = catNormal[5] = Content.Load <Texture2D>("cat/cat normal 2");
            catNormal[2] = catNormal[4] = Content.Load <Texture2D>("cat/cat normal 3");
            catNormal[3] = Content.Load <Texture2D>("cat/cat normal 4");
            catHit[0]    = catHit[4] = Content.Load <Texture2D>("cat/cat hit 1");
            catHit[1]    = catHit[3] = Content.Load <Texture2D>("cat/cat hit 2");
            catHit[2]    = Content.Load <Texture2D>("cat/cat hit 3");
            catHit[5]    = catHit[7] = Content.Load <Texture2D>("cat/cat hit 4");
            catHit[6]    = Content.Load <Texture2D>("cat/cat hit 5");

            explosionTexture = Content.Load <Texture2D>("explosion particle");

            // Load backgrounds
            backgrounds[0] = Content.Load <Texture2D>("backdrops/canyons");
            backgrounds[2] = Content.Load <Texture2D>("backdrops/caves");
            backgrounds[3] = Content.Load <Texture2D>("backdrops/warzone");
            backgrounds[4] = Content.Load <Texture2D>("backdrops/frozenwasteland");
            backgrounds[5] = Content.Load <Texture2D>("backdrops/underwater");
            backgrounds[6] = Content.Load <Texture2D>("backdrops/underwater transition");
            //backgrounds[7] = Content.Load<Texture2D>("backdrops/fault line");

            // Load sounds and music
            hitWall = Content.Load <SoundEffect>("thump");
            flap    = Content.Load <SoundEffect>("whoosh");
            meow    = Content.Load <SoundEffect>("meow");

            // Load cats
            HUDCat = new Cat(Vector2.Zero, -1, null,
                             new AnimatedTexture(catNormal, 4, false), new AnimatedTexture(catHit, 4, false), font);
            cats[0] = new Cat(Vector2.Zero, 0,
                              "                  Welcome to Cat Planet 2!\n" +
                              "This is an extra ammount of text to test my drawing method!\n" +
                              "                          BEANS",
                              new AnimatedTexture(catNormal, 4, false), new AnimatedTexture(catHit, 4, false), font);
            cats[1] = new Cat(Vector2.Zero, 1,
                              "Double the cat planet!",
                              new AnimatedTexture(catNormal, 4, false), new AnimatedTexture(catHit, 4, false), font);
            cats[2] = new Cat(Vector2.Zero, 2,
                              "Idk!",
                              new AnimatedTexture(catNormal, 4, false), new AnimatedTexture(catHit, 4, false), font);

            // Load levels
            levels[11, 0] = new Level(new Vector2(11, 0), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/11-0"), cats, obTextures);
            levels[11, 1] = new Level(new Vector2(11, 1), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/11-1"), cats, obTextures);

            currentLevel  = levels[11, 0];
            previousLevel = levels[10, 0];
            angel         = new Angel(angelNormal, angelFly, hitWall, flap, new Vector2(windowWidth / 2, windowHeight - 128));
        }
Exemple #5
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font = Content.Load<SpriteFont>("font");

            // Load sprites
            angelNormalTexture[0] = Content.Load<Texture2D>("angel/angel normal 1");
            angelNormalTexture[1] = Content.Load<Texture2D>("angel/angel normal 2");
            angelFlyTexture[0] = Content.Load<Texture2D>("angel/angel fly 1");
            angelFlyTexture[1] = Content.Load<Texture2D>("angel/angel fly 2");
            angelFlyTexture[2] = Content.Load<Texture2D>("angel/angel fly 3");

            catNormalTexture[0] = catNormalTexture[6] = Content.Load<Texture2D>("cat/cat normal 1");
            catNormalTexture[1] = catNormalTexture[5] = Content.Load<Texture2D>("cat/cat normal 2");
            catNormalTexture[2] = catNormalTexture[4] = Content.Load<Texture2D>("cat/cat normal 3");
            catNormalTexture[3] = Content.Load<Texture2D>("cat/cat normal 4");
            catHitTexture[0] = catHitTexture[4] = Content.Load<Texture2D>("cat/cat hit 1");
            catHitTexture[1] = catHitTexture[3] = Content.Load<Texture2D>("cat/cat hit 2");
            catHitTexture[2] = Content.Load<Texture2D>("cat/cat hit 3");
            catHitTexture[5] = catHitTexture[7] = Content.Load<Texture2D>("cat/cat hit 4");
            catHitTexture[6] = Content.Load<Texture2D>("cat/cat hit 5");

            gemTexture = Content.Load<Texture2D>("gem");

            explosionTexture = Content.Load<Texture2D>("explosion particle");

            // Load backgrounds
            backgrounds[0] = Content.Load<Texture2D>("backdrops/canyons");
            backgrounds[2] = Content.Load<Texture2D>("backdrops/caves");
            backgrounds[3] = Content.Load<Texture2D>("backdrops/warzone");
            //backgrounds[4] = Content.Load<Texture2D>("backdrops/lab");
            backgrounds[5] = Content.Load<Texture2D>("backdrops/underwater");
            backgrounds[6] = Content.Load<Texture2D>("backdrops/underwater transition");
            //backgrounds[7] = Content.Load<Texture2D>("backdrops/final");

            // Load sounds and music
            hitWall = Content.Load<SoundEffect>("thump");
            flap = Content.Load<SoundEffect>("whoosh");
            meow = Content.Load<SoundEffect>("meow");

            // Load cats
            HUDCat = new Cat(Vector2.Zero, -1, null,
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[0] = new Cat(Vector2.Zero, 0,
                "Welcome to Cat Planet 2!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[1] = new Cat(Vector2.Zero, 1,
                "Double the cat planet!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[2] = new Cat(Vector2.Zero, 2,
                "I'm lost :(",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[3] = new Cat(Vector2.Zero, 3,
                "Explore more Cat Planet!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[4] = new Cat(Vector2.Zero, 4,
                "Cat Village was destroyed by the crows!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[5] = new Cat(Vector2.Zero, 5,
                "So we moved here!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[6] = new Cat(Vector2.Zero, 6,
                "Cat Planet Canyon Planet!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[7] = new Cat(Vector2.Zero, 7,
                "Find all of the gems of light!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[8] = new Cat(Vector2.Zero, 8,
                "Uncover the secrets of Cat Planet!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[9] = new Cat(Vector2.Zero, 9,
                "You need to collect the gems to\n" +
                "        prove yourself!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[10] = new Cat(Vector2.Zero, 10,
                "Our friend is gone!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[11] = new Cat(Vector2.Zero, 11,
                "He went up and never came back!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);

            // Load gems
            gems[0] = new Gem(Vector2.Zero, gemTexture, Color.Cyan);
            gems[1] = new Gem(Vector2.Zero, gemTexture, Color.Lime);
            gems[2] = new Gem(Vector2.Zero, gemTexture, Color.Red);
            gems[3] = new Gem(Vector2.Zero, gemTexture, Color.Yellow);
            gems[4] = new Gem(Vector2.Zero, gemTexture, Color.Violet);

            // Load levels
            StreamReader sr = new StreamReader("Content/levels.txt");
            levels[9, 0] = new Level(sr, new Vector2(9, 0), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/9-0"), cats, gems, obTextures);
            levels[9, 1] = new Level(sr, new Vector2(9, 1), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/9-1"), cats, gems, obTextures);
            levels[9, 2] = new Level(sr, new Vector2(9, 2), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/9-2"), cats, gems, obTextures);
            levels[9, 3] = new Level(sr, new Vector2(9, 3), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/9-3"), cats, gems, obTextures);
            levels[9, 4] = new Level(sr, new Vector2(9, 4), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/9-4"), cats, gems, obTextures);
            levels[10, 0] = new Level(sr, new Vector2(10, 0), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/10-0"), cats, gems, obTextures);
            levels[10, 1] = new Level(sr, new Vector2(10, 1), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/10-1"), cats, gems, obTextures);
            levels[10, 2] = new Level(sr, new Vector2(10, 2), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/10-2"), cats, gems, obTextures);
            levels[10, 3] = new Level(sr, new Vector2(10, 3), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/10-3"), cats, gems, obTextures);
            levels[10, 4] = new Level(sr, new Vector2(10, 4), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/10-4"), cats, gems, obTextures);
            levels[11, 0] = new Level(sr, new Vector2(11, 0), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/11-0"), cats, gems, obTextures);
            levels[11, 1] = new Level(sr, new Vector2(11, 1), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/11-1"), cats, gems, obTextures);
            levels[11, 2] = new Level(sr, new Vector2(11, 2), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/11-2"), cats, gems, obTextures);
            levels[11, 3] = new Level(sr, new Vector2(11, 3), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/11-3"), cats, gems, obTextures);
            levels[11, 4] = new Level(sr, new Vector2(11, 4), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/11-4"), cats, gems, obTextures);

            currentLevel = levels[11, 0];
            previousLevel = levels[10, 0];
            angel = new Angel(angelNormalTexture, angelFlyTexture, hitWall, flap, new Vector2(windowWidth / 2, windowHeight - 128));
        }
Exemple #6
0
        public bool Update(Angel angel, List <Wall> walls, List <Link> links)
        {
            Vector2 direction = new Vector2(angel.hitBox.X - position.X, angel.hitBox.Y - position.Y);
            float   angleTo   = (float)Math.Acos(direction.X / direction.Length());

            if (direction.Y < 0)
            {
                angleTo *= -1;
            }

            if (angleTo < 0)
            {
                angleTo += MathHelper.TwoPi;
            }
            else if (angleTo >= MathHelper.TwoPi)
            {
                angleTo -= MathHelper.TwoPi;
            }
            if (angle < 0)
            {
                angle += MathHelper.TwoPi;
            }
            else if (angle >= MathHelper.TwoPi)
            {
                angle -= MathHelper.TwoPi;
            }

            if (angleTo > angle)
            {
                if (angleTo - angle < MathHelper.Pi)
                {
                    angle += 0.04f;
                }
                else
                {
                    angle -= 0.04f;
                }
            }
            else
            if (angle - angleTo > MathHelper.Pi)
            {
                angle += 0.04f;
            }
            else
            {
                angle -= 0.04f;
            }

            motion    = new Vector2((float)Math.Cos(angle) * 8, (float)Math.Sin(angle) * 8);
            position += motion;
            hitBox.X  = (int)position.X;
            hitBox.Y  = (int)position.Y;

            for (int i = 0; i < trail.Count; i++)
            {
                if (trail[i].Update())
                {
                    trail.RemoveAt(i);
                }
            }
            trail.Insert(0, new TrailPiece(10, position, trailTexture));
            if (hitBox.Intersects(angel.hitBox))
            {
                return(true);
            }
            foreach (Wall w in walls)
            {
                if (hitBox.Intersects(w.hitBox))
                {
                    return(true);
                }
            }
            foreach (Link w in links)
            {
                if (hitBox.Intersects(w.hitBox))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #7
0
        protected override void LoadContent()
        {
            spriteBatch         = new SpriteBatch(GraphicsDevice);
            levelTextureHandler = new ContentManager(this.Services, "Content");
            font = Content.Load <SpriteFont>("font");

            #region Load angel
            angelNormalTexture[0] = Content.Load <Texture2D>("angel/angel normal 1");
            angelNormalTexture[1] = Content.Load <Texture2D>("angel/angel normal 2");
            angelFlyTexture[0]    = Content.Load <Texture2D>("angel/angel fly 1");
            angelFlyTexture[1]    = Content.Load <Texture2D>("angel/angel fly 2");
            angelFlyTexture[2]    = Content.Load <Texture2D>("angel/angel fly 3");
            #endregion
            #region Load cat
            catNormalTexture[0] = catNormalTexture[6] = Content.Load <Texture2D>("cat/cat normal 1");
            catNormalTexture[1] = catNormalTexture[5] = Content.Load <Texture2D>("cat/cat normal 2");
            catNormalTexture[2] = catNormalTexture[4] = Content.Load <Texture2D>("cat/cat normal 3");
            catNormalTexture[3] = Content.Load <Texture2D>("cat/cat normal 4");
            catHitTexture[0]    = catHitTexture[4] = Content.Load <Texture2D>("cat/cat hit 1");
            catHitTexture[1]    = catHitTexture[3] = Content.Load <Texture2D>("cat/cat hit 2");
            catHitTexture[2]    = Content.Load <Texture2D>("cat/cat hit 3");
            catHitTexture[5]    = catHitTexture[7] = Content.Load <Texture2D>("cat/cat hit 4");
            catHitTexture[6]    = Content.Load <Texture2D>("cat/cat hit 5");
            #endregion
            #region Load objects
            gemTexture       = Content.Load <Texture2D>("objects/gem");
            pixel            = Content.Load <Texture2D>("pixel");
            explosionTexture = Content.Load <Texture2D>("objects/explosion particle");

            Texture2D[] fenceTexture = new Texture2D[1];
            fenceTexture[0] = Content.Load <Texture2D>("pixel");
            obTextures.Add("fence", fenceTexture);
            Texture2D[] rockTexture = new Texture2D[1];
            rockTexture[0] = Content.Load <Texture2D>("objects/rock");
            obTextures.Add("rock", rockTexture);
            Texture2D[] buttonTexture = new Texture2D[1];
            buttonTexture[0] = Content.Load <Texture2D>("objects/button");
            obTextures.Add("button", buttonTexture);
            Texture2D[] timeFrontTexture = new Texture2D[1];
            timeFrontTexture[0] = Content.Load <Texture2D>("objects/timer front");
            obTextures.Add("timefront", timeFrontTexture);
            Texture2D[] timeBackTexture = new Texture2D[1];
            timeBackTexture[0] = Content.Load <Texture2D>("objects/timer back");
            obTextures.Add("timeback", timeBackTexture);
            Texture2D[] plasmaTexture = new Texture2D[3];
            plasmaTexture[0] = Content.Load <Texture2D>("objects/plasma ball 1");
            plasmaTexture[1] = Content.Load <Texture2D>("objects/plasma ball 2");
            plasmaTexture[2] = Content.Load <Texture2D>("objects/plasma ball 3");
            obTextures.Add("plasma", plasmaTexture);
            Texture2D[] rocketTexture = new Texture2D[1];
            rocketTexture[0] = Content.Load <Texture2D>("objects/rocket");
            obTextures.Add("rocket", rocketTexture);
            Texture2D[] launcherTexture = new Texture2D[1];
            launcherTexture[0] = Content.Load <Texture2D>("objects/launcher");
            obTextures.Add("launcher", launcherTexture);
            Texture2D[] trailTexture = new Texture2D[1];
            trailTexture[0] = explosionTexture;
            obTextures.Add("trail", trailTexture);
            Texture2D[] bubbleTexture = new Texture2D[1];
            bubbleTexture[0] = explosionTexture;
            obTextures.Add("bubble", bubbleTexture);
            Texture2D[] starTexture = new Texture2D[1];
            starTexture[0] = Content.Load <Texture2D>("objects/starfish");
            obTextures.Add("starfish", starTexture);
            Texture2D[] fishTexture = new Texture2D[2];
            fishTexture[0] = Content.Load <Texture2D>("objects/fish 1");
            fishTexture[1] = Content.Load <Texture2D>("objects/fish 2");
            obTextures.Add("fish", fishTexture);
            #endregion
            #region Load music
            canyonSong = Content.Load <Song>("canyonmus");
            caveSong   = Content.Load <Song>("cavemus");
            labSong    = Content.Load <Song>("labmus");
            warSong    = Content.Load <Song>("warmus");
            waterSong  = Content.Load <Song>("watermus");
            finalSong  = Content.Load <Song>("finalmus");
            #endregion
            #region Load sounds
            hitWall           = Content.Load <SoundEffect>("thump");
            flap              = Content.Load <SoundEffect>("whoosh");
            meow              = Content.Load <SoundEffect>("meow");
            explode           = Content.Load <SoundEffect>("explosion");
            die               = Content.Load <SoundEffect>("dead");
            getGem            = Content.Load <SoundEffect>("get gem");
            ticking           = Content.Load <SoundEffect>("ticking");
            loopTick          = ticking.CreateInstance();
            loopTick.IsLooped = true;
            loopTick.Volume   = 0.25f;
            rocketLaunch      = Content.Load <SoundEffect>("rocket launch");
            creditsMus        = Content.Load <SoundEffect>("credits");
            #endregion
            #region Load easter egg
            easterEgg            = Content.Load <Video>("easter egg");
            videoPlayer.IsLooped = true;
            videoPlayer.Volume   = 1.0f;
            #endregion

            #region Instantiate cats
            HUDCat = new Cat(Vector2.Zero, -1, null,
                             new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[0] = new Cat(Vector2.Zero, 0,
                              "Welcome to Cat Planet 2!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[1] = new Cat(Vector2.Zero, 1,
                              "Double the cat planet!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[2] = new Cat(Vector2.Zero, 2,
                              "I'm lost :(",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[3] = new Cat(Vector2.Zero, 3,
                              "Explore more Cat Planet!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[4] = new Cat(Vector2.Zero, 4,
                              "Cat Village was destroyed by the crows!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[5] = new Cat(Vector2.Zero, 5,
                              "So we moved here!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[6] = new Cat(Vector2.Zero, 6,
                              "Cat Planet Canyon Planet!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[7] = new Cat(Vector2.Zero, 7,
                              "Find all of the gems of light!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[8] = new Cat(Vector2.Zero, 8,
                              "Uncover the secrets of Cat Planet!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[9] = new Cat(Vector2.Zero, 9,
                              "You need to collect the gems to\n" +
                              "        prove yourself!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[10] = new Cat(Vector2.Zero, 10,
                               "Our friend is gone!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[11] = new Cat(Vector2.Zero, 11,
                               "He went up and never came back!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[12] = new Cat(Vector2.Zero, 12,
                               "These caves are scary!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[13] = new Cat(Vector2.Zero, 13,
                               "I'm in a ditch.",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[14] = new Cat(Vector2.Zero, 14,
                               "The gem is close by!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[15] = new Cat(Vector2.Zero, 15,
                               "It's left from here.",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[16] = new Cat(Vector2.Zero, 16,
                               "It's down there!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[17] = new Cat(Vector2.Zero, 17,
                               "Did you get the gem?",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[18] = new Cat(Vector2.Zero, 18,
                               "I wasn't in the first game!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[19] = new Cat(Vector2.Zero, 19,
                               "The fish are evil!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[20] = new Cat(Vector2.Zero, 20,
                               "There's more danger past these spikes!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[21] = new Cat(Vector2.Zero, 21,
                               "There's a secret close by.",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[22] = new Cat(Vector2.Zero, 22,
                               "I don't know where these rocks\n" +
                               "      are coming from!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[23] = new Cat(Vector2.Zero, 23,
                               "The fish have made Cat Planet\n" +
                               "     a dangerous place!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[24] = new Cat(Vector2.Zero, 24,
                               "War is not the answer!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[25] = new Cat(Vector2.Zero, 25,
                               "Cat!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[26] = new Cat(Vector2.Zero, 26,
                               "Pla!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[27] = new Cat(Vector2.Zero, 27,
                               "Net!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[28] = new Cat(Vector2.Zero, 28,
                               "Help!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[29] = new Cat(Vector2.Zero, 29,
                               "Up there is a war zone!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[30] = new Cat(Vector2.Zero, 30,
                               "Spinning plasma of doom!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[31] = new Cat(Vector2.Zero, 31,
                               "Obviously work of the fish!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[32] = new Cat(Vector2.Zero, 32,
                               "The gem!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[33] = new Cat(Vector2.Zero, 33,
                               "Be careful here!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[34] = new Cat(Vector2.Zero, 34,
                               "The cat below me is lying!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[35] = new Cat(Vector2.Zero, 35,
                               "The bottom cat is\n" +
                               "telling the truth!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[36] = new Cat(Vector2.Zero, 36,
                               "I'm lying!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[37] = new Cat(Vector2.Zero, 37,
                               "The first cat is the same\n" +
                               "  as the one above me!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[38] = new Cat(Vector2.Zero, 38,
                               "Those rocket launchers are\n" +
                               "       dangerous!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[39] = new Cat(Vector2.Zero, 39,
                               "Explosions are cool!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[40] = new Cat(Vector2.Zero, 40,
                               "More rocks!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[41] = new Cat(Vector2.Zero, 41,
                               "   The crows are no more,\n" +
                               "but the fish are much worse.",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[42] = new Cat(Vector2.Zero, 42,
                               "So much destruction!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[43] = new Cat(Vector2.Zero, 43,
                               "We're losing!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[44] = new Cat(Vector2.Zero, 44,
                               "The gem here is well\n" +
                               "     protected!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[45] = new Cat(Vector2.Zero, 45,
                               "My friend is trapped!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[46] = new Cat(Vector2.Zero, 46,
                               "I'm actually safe from\n" +
                               " the rockets up here!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[47] = new Cat(Vector2.Zero, 47,
                               "Reminds me of 'Nam.",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[48] = new Cat(Vector2.Zero, 48,
                               "I think that's what we're\n" +
                               "    fighting over...",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[49] = new Cat(Vector2.Zero, 49,
                               "They're everywhere!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[50] = new Cat(Vector2.Zero, 50,
                               "Imperialist fish!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[51] = new Cat(Vector2.Zero, 51,
                               "We're underwater!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[52] = new Cat(Vector2.Zero, 52,
                               "Cat Planet Ocean!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[53] = new Cat(Vector2.Zero, 53,
                               "The bubbles carry\n" +
                               "   you places!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[54] = new Cat(Vector2.Zero, 54,
                               "Cats don't like water!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[55] = new Cat(Vector2.Zero, 55,
                               "BUBBLES!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[56] = new Cat(Vector2.Zero, 56,
                               "Time it right!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[57] = new Cat(Vector2.Zero, 57,
                               "Starfish are dangerous!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[58] = new Cat(Vector2.Zero, 58,
                               "But they're nothing \n" +
                               "  compared to the\n" +
                               "       fish!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[59] = new Cat(Vector2.Zero, 59,
                               "You're close to the\n" +
                               "  final struggle!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[60] = new Cat(Vector2.Zero, 60,
                               "You need all the gems\n" +
                               "of light to continue!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[61] = new Cat(Vector2.Zero, 61,
                               "  Do you have 62 cats?\n" +
                               "There's no turning back.",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[62] = new Cat(Vector2.Zero, 62,
                               "It's the fish!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[63] = new Cat(Vector2.Zero, 63,
                               "The fish are dangerous!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[64] = new Cat(Vector2.Zero, 64,
                               "Keep going!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[65] = new Cat(Vector2.Zero, 65,
                               "You're getting close!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[66] = new Cat(Vector2.Zero, 66,
                               "You have to go up!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[67] = new Cat(Vector2.Zero, 67,
                               "You did it!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            #endregion
            #region Instantiate gems
            gems[0] = new Gem(Vector2.Zero, gemTexture, Color.Cyan);
            gems[1] = new Gem(Vector2.Zero, gemTexture, Color.Lime);
            gems[2] = new Gem(Vector2.Zero, gemTexture, Color.Red);
            gems[3] = new Gem(Vector2.Zero, gemTexture, Color.Yellow);
            gems[4] = new Gem(Vector2.Zero, gemTexture, Color.Violet);
            #endregion
            #region Instantiate final fences
            finalFences[0] = new ElectricFence(new Rectangle(319, 478, 349, 32), obTextures["fence"][0], Color.Cyan, 0);
            finalFences[1] = new ElectricFence(new Rectangle(319, 527, 349, 32), obTextures["fence"][0], Color.Lime, 1);
            finalFences[2] = new ElectricFence(new Rectangle(319, 576, 349, 32), obTextures["fence"][0], Color.Red, 2);
            finalFences[3] = new ElectricFence(new Rectangle(319, 625, 349, 32), obTextures["fence"][0], Color.Yellow, 3);
            finalFences[4] = new ElectricFence(new Rectangle(319, 674, 349, 32), obTextures["fence"][0], Color.Violet, 4);
            #endregion

            StreamReader sr = new StreamReader("Content/levels/11-0.txt");
            levels[11, 0] = new Level(sr, new Vector2(11, 0), Level.Type.Canyons, Content.Load <Texture2D>("backdrops/canyons"), levelTextureHandler.Load <Texture2D>("foregrounds/11-0"), cats, gems, obTextures);
            sr.Close();
            sr            = new StreamReader("Content/levels/10-0.txt");
            levels[10, 0] = new Level(sr, new Vector2(10, 0), Level.Type.Canyons, Content.Load <Texture2D>("backdrops/canyons"), levelTextureHandler.Load <Texture2D>("foregrounds/10-0"), cats, gems, obTextures);
            sr.Close();
            sr           = new StreamReader("Content/levels/0-0.txt");
            levels[0, 0] = new Level(sr, new Vector2(0, 0), Level.Type.Final, Content.Load <Texture2D>("backdrops/final"), levelTextureHandler.Load <Texture2D>("pixel"), cats, gems, obTextures);
            sr.Close();
            sr.Dispose();

            currentLevel  = levels[11, 0];
            previousLevel = levels[10, 0];
            LoadLevels();

            angel = new Angel(angelNormalTexture, angelFlyTexture, hitWall, flap, new Vector2(windowWidth / 2, 459));
            MediaPlayer.Volume      = 0.85f;
            MediaPlayer.IsRepeating = true;
            ChangeSong();
        }
Exemple #8
0
        public void Update(Angel angel, List <Wall> walls, List <Fish> otherfish)
        {
            Vector2 direction = new Vector2(angel.hitBox.X - hitBox.X, angel.hitBox.Y - hitBox.Y);

            angle = (float)Math.Acos(direction.X / direction.Length());
            if (direction.Y < 0)
            {
                angle *= -1;
            }

            if (angel.position.X > this.position.X && this.motion.X < 7)
            {
                this.motion.X += 0.25f;
            }
            else if (angel.position.X < this.position.X && this.motion.X > -7)
            {
                this.motion.X -= 0.25f;
            }
            if (angel.position.Y > this.position.Y && this.motion.Y < 7)
            {
                this.motion.Y += 0.25f;
            }
            else if (angel.position.Y < this.position.Y && this.motion.Y > -7)
            {
                this.motion.Y -= 0.25f;
            }

            position += motion;
            UpdateHitBox();

            texture.Update();

            foreach (Wall w in walls)
            {
                if (this.hitBox.Intersects(w.hitBox))
                {
                    Vector2 unit = motion;
                    unit.Normalize();
                    while (this.hitBox.Intersects(w.hitBox))
                    {
                        this.position -= unit;
                        UpdateHitBox();
                    }

                    if (this.hitBox.Left < w.hitBox.Right && this.hitBox.Right > w.hitBox.Left)
                    {
                        if (this.hitBox.Bottom <= w.hitBox.Top)
                        {
                            this.position.Y = w.hitBox.Y - 48;
                        }
                        else
                        {
                            this.position.Y = w.hitBox.Bottom;
                        }
                        motion.Y *= -1;
                    }

                    if (this.hitBox.Top < w.hitBox.Bottom && this.hitBox.Bottom > w.hitBox.Top)
                    {
                        if (this.hitBox.Right <= w.hitBox.Left)
                        {
                            this.position.X = w.hitBox.X - 48;
                        }
                        else
                        {
                            this.position.X = w.hitBox.Right;
                        }
                        motion.X *= -1;
                    }
                }
            }
            foreach (Fish w in otherfish)
            {
                if (w == this)
                {
                    continue;
                }
                if (this.hitBox.Intersects(w.hitBox))
                {
                    Vector2 unit = motion;
                    unit.Normalize();
                    while (this.hitBox.Intersects(w.hitBox))
                    {
                        this.position -= unit;
                        UpdateHitBox();
                    }

                    if (this.hitBox.Left < w.hitBox.Right && this.hitBox.Right > w.hitBox.Left)
                    {
                        if (this.hitBox.Bottom <= w.hitBox.Top)
                        {
                            this.position.Y = w.hitBox.Y - 48;
                        }
                        else
                        {
                            this.position.Y = w.hitBox.Bottom;
                        }
                        motion.Y *= -1;
                    }

                    if (this.hitBox.Top < w.hitBox.Bottom && this.hitBox.Bottom > w.hitBox.Top)
                    {
                        if (this.hitBox.Right <= w.hitBox.Left)
                        {
                            this.position.X = w.hitBox.X - 48;
                        }
                        else
                        {
                            this.position.X = w.hitBox.Right;
                        }
                        motion.X *= -1;
                    }
                }
            }
        }
Exemple #9
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font        = Content.Load <SpriteFont>("font");

            // Load sprites
            angelNormalTexture[0] = Content.Load <Texture2D>("angel/angel normal 1");
            angelNormalTexture[1] = Content.Load <Texture2D>("angel/angel normal 2");
            angelFlyTexture[0]    = Content.Load <Texture2D>("angel/angel fly 1");
            angelFlyTexture[1]    = Content.Load <Texture2D>("angel/angel fly 2");
            angelFlyTexture[2]    = Content.Load <Texture2D>("angel/angel fly 3");

            catNormalTexture[0] = catNormalTexture[6] = Content.Load <Texture2D>("cat/cat normal 1");
            catNormalTexture[1] = catNormalTexture[5] = Content.Load <Texture2D>("cat/cat normal 2");
            catNormalTexture[2] = catNormalTexture[4] = Content.Load <Texture2D>("cat/cat normal 3");
            catNormalTexture[3] = Content.Load <Texture2D>("cat/cat normal 4");
            catHitTexture[0]    = catHitTexture[4] = Content.Load <Texture2D>("cat/cat hit 1");
            catHitTexture[1]    = catHitTexture[3] = Content.Load <Texture2D>("cat/cat hit 2");
            catHitTexture[2]    = Content.Load <Texture2D>("cat/cat hit 3");
            catHitTexture[5]    = catHitTexture[7] = Content.Load <Texture2D>("cat/cat hit 4");
            catHitTexture[6]    = Content.Load <Texture2D>("cat/cat hit 5");

            gemTexture = Content.Load <Texture2D>("gem");

            explosionTexture = Content.Load <Texture2D>("explosion particle");

            // Load backgrounds
            backgrounds[0] = Content.Load <Texture2D>("backdrops/canyons");
            backgrounds[2] = Content.Load <Texture2D>("backdrops/caves");
            backgrounds[3] = Content.Load <Texture2D>("backdrops/warzone");
            //backgrounds[4] = Content.Load<Texture2D>("backdrops/lab");
            backgrounds[5] = Content.Load <Texture2D>("backdrops/underwater");
            backgrounds[6] = Content.Load <Texture2D>("backdrops/underwater transition");
            //backgrounds[7] = Content.Load<Texture2D>("backdrops/final");

            // Load sounds and music
            hitWall = Content.Load <SoundEffect>("thump");
            flap    = Content.Load <SoundEffect>("whoosh");
            meow    = Content.Load <SoundEffect>("meow");

            // Load cats
            HUDCat = new Cat(Vector2.Zero, -1, null,
                             new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[0] = new Cat(Vector2.Zero, 0,
                              "Welcome to Cat Planet 2!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[1] = new Cat(Vector2.Zero, 1,
                              "Double the cat planet!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[2] = new Cat(Vector2.Zero, 2,
                              "I'm lost :(",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[3] = new Cat(Vector2.Zero, 3,
                              "Explore more Cat Planet!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[4] = new Cat(Vector2.Zero, 4,
                              "Cat Village was destroyed by the crows!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[5] = new Cat(Vector2.Zero, 5,
                              "So we moved here!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[6] = new Cat(Vector2.Zero, 6,
                              "Cat Planet Canyon Planet!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[7] = new Cat(Vector2.Zero, 7,
                              "Find all of the gems of light!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[8] = new Cat(Vector2.Zero, 8,
                              "Uncover the secrets of Cat Planet!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[9] = new Cat(Vector2.Zero, 9,
                              "You need to collect the gems to\n" +
                              "        prove yourself!",
                              new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[10] = new Cat(Vector2.Zero, 10,
                               "Our friend is gone!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[11] = new Cat(Vector2.Zero, 11,
                               "He went up and never came back!",
                               new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);

            // Load gems
            gems[0] = new Gem(Vector2.Zero, gemTexture, Color.Cyan);
            gems[1] = new Gem(Vector2.Zero, gemTexture, Color.Lime);
            gems[2] = new Gem(Vector2.Zero, gemTexture, Color.Red);
            gems[3] = new Gem(Vector2.Zero, gemTexture, Color.Yellow);
            gems[4] = new Gem(Vector2.Zero, gemTexture, Color.Violet);

            // Load levels
            StreamReader sr = new StreamReader("Content/levels.txt");

            levels[9, 0]  = new Level(sr, new Vector2(9, 0), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/9-0"), cats, gems, obTextures);
            levels[9, 1]  = new Level(sr, new Vector2(9, 1), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/9-1"), cats, gems, obTextures);
            levels[9, 2]  = new Level(sr, new Vector2(9, 2), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/9-2"), cats, gems, obTextures);
            levels[9, 3]  = new Level(sr, new Vector2(9, 3), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/9-3"), cats, gems, obTextures);
            levels[9, 4]  = new Level(sr, new Vector2(9, 4), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/9-4"), cats, gems, obTextures);
            levels[10, 0] = new Level(sr, new Vector2(10, 0), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/10-0"), cats, gems, obTextures);
            levels[10, 1] = new Level(sr, new Vector2(10, 1), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/10-1"), cats, gems, obTextures);
            levels[10, 2] = new Level(sr, new Vector2(10, 2), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/10-2"), cats, gems, obTextures);
            levels[10, 3] = new Level(sr, new Vector2(10, 3), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/10-3"), cats, gems, obTextures);
            levels[10, 4] = new Level(sr, new Vector2(10, 4), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/10-4"), cats, gems, obTextures);
            levels[11, 0] = new Level(sr, new Vector2(11, 0), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/11-0"), cats, gems, obTextures);
            levels[11, 1] = new Level(sr, new Vector2(11, 1), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/11-1"), cats, gems, obTextures);
            levels[11, 2] = new Level(sr, new Vector2(11, 2), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/11-2"), cats, gems, obTextures);
            levels[11, 3] = new Level(sr, new Vector2(11, 3), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/11-3"), cats, gems, obTextures);
            levels[11, 4] = new Level(sr, new Vector2(11, 4), Level.Type.Canyons, backgrounds[0], Content.Load <Texture2D>("foregrounds/11-4"), cats, gems, obTextures);

            currentLevel  = levels[11, 0];
            previousLevel = levels[10, 0];
            angel         = new Angel(angelNormalTexture, angelFlyTexture, hitWall, flap, new Vector2(windowWidth / 2, windowHeight - 128));
        }
Exemple #10
0
        public void Update(Angel angel, List<Wall> walls, List<Fish> otherfish)
        {
            Vector2 direction = new Vector2(angel.hitBox.X - hitBox.X, angel.hitBox.Y - hitBox.Y);
            angle = (float)Math.Acos(direction.X / direction.Length());
            if (direction.Y < 0)
                angle *= -1;

            if (angel.position.X > this.position.X && this.motion.X < 7)
                this.motion.X += 0.25f;
            else if (angel.position.X < this.position.X && this.motion.X > -7)
                this.motion.X -= 0.25f;
            if (angel.position.Y > this.position.Y && this.motion.Y < 7)
                this.motion.Y += 0.25f;
            else if (angel.position.Y < this.position.Y && this.motion.Y > -7)
                this.motion.Y -= 0.25f;

            position += motion;
            UpdateHitBox();

            texture.Update();

            foreach (Wall w in walls)
            {
                if (this.hitBox.Intersects(w.hitBox))
                {
                    Vector2 unit = motion;
                    unit.Normalize();
                    while (this.hitBox.Intersects(w.hitBox))
                    {
                        this.position -= unit;
                        UpdateHitBox();
                    }

                    if (this.hitBox.Left < w.hitBox.Right && this.hitBox.Right > w.hitBox.Left)
                    {
                        if (this.hitBox.Bottom <= w.hitBox.Top)
                            this.position.Y = w.hitBox.Y - 48;
                        else
                            this.position.Y = w.hitBox.Bottom;
                        motion.Y *= -1;
                    }

                    if (this.hitBox.Top < w.hitBox.Bottom && this.hitBox.Bottom > w.hitBox.Top)
                    {
                        if (this.hitBox.Right <= w.hitBox.Left)
                            this.position.X = w.hitBox.X - 48;
                        else
                            this.position.X = w.hitBox.Right;
                        motion.X *= -1;
                    }
                }
            }
            foreach (Fish w in otherfish)
            {
                if (w == this) continue;
                if (this.hitBox.Intersects(w.hitBox))
                {
                    Vector2 unit = motion;
                    unit.Normalize();
                    while (this.hitBox.Intersects(w.hitBox))
                    {
                        this.position -= unit;
                        UpdateHitBox();
                    }

                    if (this.hitBox.Left < w.hitBox.Right && this.hitBox.Right > w.hitBox.Left)
                    {
                        if (this.hitBox.Bottom <= w.hitBox.Top)
                            this.position.Y = w.hitBox.Y - 48;
                        else
                            this.position.Y = w.hitBox.Bottom;
                        motion.Y *= -1;
                    }

                    if (this.hitBox.Top < w.hitBox.Bottom && this.hitBox.Bottom > w.hitBox.Top)
                    {
                        if (this.hitBox.Right <= w.hitBox.Left)
                            this.position.X = w.hitBox.X - 48;
                        else
                            this.position.X = w.hitBox.Right;
                        motion.X *= -1;
                    }
                }
            }
        }
Exemple #11
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            levelTextureHandler = new ContentManager(this.Services, "Content");
            font = Content.Load<SpriteFont>("font");

            #region Load angel
            angelNormalTexture[0] = Content.Load<Texture2D>("angel/angel normal 1");
            angelNormalTexture[1] = Content.Load<Texture2D>("angel/angel normal 2");
            angelFlyTexture[0] = Content.Load<Texture2D>("angel/angel fly 1");
            angelFlyTexture[1] = Content.Load<Texture2D>("angel/angel fly 2");
            angelFlyTexture[2] = Content.Load<Texture2D>("angel/angel fly 3");
            #endregion
            #region Load cat
            catNormalTexture[0] = catNormalTexture[6] = Content.Load<Texture2D>("cat/cat normal 1");
            catNormalTexture[1] = catNormalTexture[5] = Content.Load<Texture2D>("cat/cat normal 2");
            catNormalTexture[2] = catNormalTexture[4] = Content.Load<Texture2D>("cat/cat normal 3");
            catNormalTexture[3] = Content.Load<Texture2D>("cat/cat normal 4");
            catHitTexture[0] = catHitTexture[4] = Content.Load<Texture2D>("cat/cat hit 1");
            catHitTexture[1] = catHitTexture[3] = Content.Load<Texture2D>("cat/cat hit 2");
            catHitTexture[2] = Content.Load<Texture2D>("cat/cat hit 3");
            catHitTexture[5] = catHitTexture[7] = Content.Load<Texture2D>("cat/cat hit 4");
            catHitTexture[6] = Content.Load<Texture2D>("cat/cat hit 5");
            #endregion
            #region Load objects
            gemTexture = Content.Load<Texture2D>("objects/gem");
            pixel = Content.Load<Texture2D>("pixel");
            explosionTexture = Content.Load<Texture2D>("objects/explosion particle");

            Texture2D[] fenceTexture = new Texture2D[1];
            fenceTexture[0] = Content.Load<Texture2D>("pixel");
            obTextures.Add("fence", fenceTexture);
            Texture2D[] rockTexture = new Texture2D[1];
            rockTexture[0] = Content.Load<Texture2D>("objects/rock");
            obTextures.Add("rock", rockTexture);
            Texture2D[] buttonTexture = new Texture2D[1];
            buttonTexture[0] = Content.Load<Texture2D>("objects/button");
            obTextures.Add("button", buttonTexture);
            Texture2D[] timeFrontTexture = new Texture2D[1];
            timeFrontTexture[0] = Content.Load<Texture2D>("objects/timer front");
            obTextures.Add("timefront", timeFrontTexture);
            Texture2D[] timeBackTexture = new Texture2D[1];
            timeBackTexture[0] = Content.Load<Texture2D>("objects/timer back");
            obTextures.Add("timeback", timeBackTexture);
            Texture2D[] plasmaTexture = new Texture2D[3];
            plasmaTexture[0] = Content.Load<Texture2D>("objects/plasma ball 1");
            plasmaTexture[1] = Content.Load<Texture2D>("objects/plasma ball 2");
            plasmaTexture[2] = Content.Load<Texture2D>("objects/plasma ball 3");
            obTextures.Add("plasma", plasmaTexture);
            Texture2D[] rocketTexture = new Texture2D[1];
            rocketTexture[0] = Content.Load<Texture2D>("objects/rocket");
            obTextures.Add("rocket", rocketTexture);
            Texture2D[] launcherTexture = new Texture2D[1];
            launcherTexture[0] = Content.Load<Texture2D>("objects/launcher");
            obTextures.Add("launcher", launcherTexture);
            Texture2D[] trailTexture = new Texture2D[1];
            trailTexture[0] = explosionTexture;
            obTextures.Add("trail", trailTexture);
            Texture2D[] bubbleTexture = new Texture2D[1];
            bubbleTexture[0] = explosionTexture;
            obTextures.Add("bubble", bubbleTexture);
            Texture2D[] starTexture = new Texture2D[1];
            starTexture[0] = Content.Load<Texture2D>("objects/starfish");
            obTextures.Add("starfish", starTexture);
            Texture2D[] fishTexture = new Texture2D[2];
            fishTexture[0] = Content.Load<Texture2D>("objects/fish 1");
            fishTexture[1] = Content.Load<Texture2D>("objects/fish 2");
            obTextures.Add("fish", fishTexture);
            #endregion
            #region Load music
            canyonSong = Content.Load<Song>("canyonmus");
            caveSong = Content.Load<Song>("cavemus");
            labSong = Content.Load<Song>("labmus");
            warSong = Content.Load<Song>("warmus");
            waterSong = Content.Load<Song>("watermus");
            finalSong = Content.Load<Song>("finalmus");
            #endregion
            #region Load sounds
            hitWall = Content.Load<SoundEffect>("thump");
            flap = Content.Load<SoundEffect>("whoosh");
            meow = Content.Load<SoundEffect>("meow");
            explode = Content.Load<SoundEffect>("explosion");
            die = Content.Load<SoundEffect>("dead");
            getGem = Content.Load<SoundEffect>("get gem");
            ticking = Content.Load<SoundEffect>("ticking");
            loopTick = ticking.CreateInstance();
            loopTick.IsLooped = true;
            loopTick.Volume = 0.25f;
            rocketLaunch = Content.Load<SoundEffect>("rocket launch");
            creditsMus = Content.Load<SoundEffect>("credits");
            #endregion
            #region Load easter egg
            easterEgg = Content.Load<Video>("easter egg");
            videoPlayer.IsLooped = true;
            videoPlayer.Volume = 1.0f;
            #endregion

            #region Instantiate cats
            HUDCat = new Cat(Vector2.Zero, -1, null,
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[0] = new Cat(Vector2.Zero, 0,
                "Welcome to Cat Planet 2!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[1] = new Cat(Vector2.Zero, 1,
                "Double the cat planet!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[2] = new Cat(Vector2.Zero, 2,
                "I'm lost :(",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[3] = new Cat(Vector2.Zero, 3,
                "Explore more Cat Planet!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[4] = new Cat(Vector2.Zero, 4,
                "Cat Village was destroyed by the crows!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[5] = new Cat(Vector2.Zero, 5,
                "So we moved here!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[6] = new Cat(Vector2.Zero, 6,
                "Cat Planet Canyon Planet!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[7] = new Cat(Vector2.Zero, 7,
                "Find all of the gems of light!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[8] = new Cat(Vector2.Zero, 8,
                "Uncover the secrets of Cat Planet!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[9] = new Cat(Vector2.Zero, 9,
                "You need to collect the gems to\n" +
                "        prove yourself!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[10] = new Cat(Vector2.Zero, 10,
                "Our friend is gone!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[11] = new Cat(Vector2.Zero, 11,
                "He went up and never came back!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[12] = new Cat(Vector2.Zero, 12,
                "These caves are scary!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[13] = new Cat(Vector2.Zero, 13,
                "I'm in a ditch.",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[14] = new Cat(Vector2.Zero, 14,
                "The gem is close by!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[15] = new Cat(Vector2.Zero, 15,
                "It's left from here.",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[16] = new Cat(Vector2.Zero, 16,
                "It's down there!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[17] = new Cat(Vector2.Zero, 17,
                "Did you get the gem?",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[18] = new Cat(Vector2.Zero, 18,
                "I wasn't in the first game!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[19] = new Cat(Vector2.Zero, 19,
                "The fish are evil!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[20] = new Cat(Vector2.Zero, 20,
                "There's more danger past these spikes!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[21] = new Cat(Vector2.Zero, 21,
                "There's a secret close by.",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[22] = new Cat(Vector2.Zero, 22,
                "I don't know where these rocks\n" +
                "      are coming from!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[23] = new Cat(Vector2.Zero, 23,
                "The fish have made Cat Planet\n" +
                "     a dangerous place!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[24] = new Cat(Vector2.Zero, 24,
                "War is not the answer!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[25] = new Cat(Vector2.Zero, 25,
                "Cat!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[26] = new Cat(Vector2.Zero, 26,
                "Pla!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[27] = new Cat(Vector2.Zero, 27,
                "Net!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[28] = new Cat(Vector2.Zero, 28,
                "Help!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[29] = new Cat(Vector2.Zero, 29,
                "Up there is a war zone!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[30] = new Cat(Vector2.Zero, 30,
                "Spinning plasma of doom!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[31] = new Cat(Vector2.Zero, 31,
                "Obviously work of the fish!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[32] = new Cat(Vector2.Zero, 32,
                "The gem!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[33] = new Cat(Vector2.Zero, 33,
                "Be careful here!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[34] = new Cat(Vector2.Zero, 34,
                "The cat below me is lying!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[35] = new Cat(Vector2.Zero, 35,
                "The bottom cat is\n" +
                "telling the truth!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[36] = new Cat(Vector2.Zero, 36,
                "I'm lying!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[37] = new Cat(Vector2.Zero, 37,
                "The first cat is the same\n" +
                "  as the one above me!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[38] = new Cat(Vector2.Zero, 38,
                "Those rocket launchers are\n" +
                "       dangerous!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[39] = new Cat(Vector2.Zero, 39,
                "Explosions are cool!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[40] = new Cat(Vector2.Zero, 40,
                "More rocks!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[41] = new Cat(Vector2.Zero, 41,
                "   The crows are no more,\n" +
                "but the fish are much worse.",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[42] = new Cat(Vector2.Zero, 42,
                "So much destruction!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[43] = new Cat(Vector2.Zero, 43,
                "We're losing!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[44] = new Cat(Vector2.Zero, 44,
                "The gem here is well\n" +
                "     protected!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[45] = new Cat(Vector2.Zero, 45,
                "My friend is trapped!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[46] = new Cat(Vector2.Zero, 46,
                "I'm actually safe from\n" +
                " the rockets up here!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[47] = new Cat(Vector2.Zero, 47,
                "Reminds me of 'Nam.",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[48] = new Cat(Vector2.Zero, 48,
                "I think that's what we're\n" +
                "    fighting over...",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[49] = new Cat(Vector2.Zero, 49,
                "They're everywhere!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[50] = new Cat(Vector2.Zero, 50,
                "Imperialist fish!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[51] = new Cat(Vector2.Zero, 51,
                "We're underwater!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[52] = new Cat(Vector2.Zero, 52,
                "Cat Planet Ocean!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[53] = new Cat(Vector2.Zero, 53,
                "The bubbles carry\n" +
                "   you places!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[54] = new Cat(Vector2.Zero, 54,
                "Cats don't like water!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[55] = new Cat(Vector2.Zero, 55,
                "BUBBLES!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[56] = new Cat(Vector2.Zero, 56,
                "Time it right!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[57] = new Cat(Vector2.Zero, 57,
                "Starfish are dangerous!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[58] = new Cat(Vector2.Zero, 58,
                "But they're nothing \n" +
                "  compared to the\n" +
                "       fish!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[59] = new Cat(Vector2.Zero, 59,
                "You're close to the\n" +
                "  final struggle!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[60] = new Cat(Vector2.Zero, 60,
                "You need all the gems\n" +
                "of light to continue!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[61] = new Cat(Vector2.Zero, 61,
                "  Do you have 62 cats?\n" +
                "There's no turning back.",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[62] = new Cat(Vector2.Zero, 62,
                "It's the fish!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[63] = new Cat(Vector2.Zero, 63,
                "The fish are dangerous!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[64] = new Cat(Vector2.Zero, 64,
                "Keep going!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[65] = new Cat(Vector2.Zero, 65,
                "You're getting close!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[66] = new Cat(Vector2.Zero, 66,
                "You have to go up!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            cats[67] = new Cat(Vector2.Zero, 67,
                "You did it!",
                new AnimatedTexture(catNormalTexture, 4, false), new AnimatedTexture(catHitTexture, 4, false), font);
            #endregion
            #region Instantiate gems
            gems[0] = new Gem(Vector2.Zero, gemTexture, Color.Cyan);
            gems[1] = new Gem(Vector2.Zero, gemTexture, Color.Lime);
            gems[2] = new Gem(Vector2.Zero, gemTexture, Color.Red);
            gems[3] = new Gem(Vector2.Zero, gemTexture, Color.Yellow);
            gems[4] = new Gem(Vector2.Zero, gemTexture, Color.Violet);
            #endregion
            #region Instantiate final fences
            finalFences[0] = new ElectricFence(new Rectangle(319, 478, 349, 32), obTextures["fence"][0], Color.Cyan, 0);
            finalFences[1] = new ElectricFence(new Rectangle(319, 527, 349, 32), obTextures["fence"][0], Color.Lime, 1);
            finalFences[2] = new ElectricFence(new Rectangle(319, 576, 349, 32), obTextures["fence"][0], Color.Red, 2);
            finalFences[3] = new ElectricFence(new Rectangle(319, 625, 349, 32), obTextures["fence"][0], Color.Yellow, 3);
            finalFences[4] = new ElectricFence(new Rectangle(319, 674, 349, 32), obTextures["fence"][0], Color.Violet, 4);
            #endregion

            StreamReader sr = new StreamReader("Content/levels/11-0.txt");
            levels[11, 0] = new Level(sr, new Vector2(11, 0), Level.Type.Canyons, Content.Load<Texture2D>("backdrops/canyons"), levelTextureHandler.Load<Texture2D>("foregrounds/11-0"), cats, gems, obTextures);
            sr.Close();
            sr = new StreamReader("Content/levels/10-0.txt");
            levels[10, 0] = new Level(sr, new Vector2(10, 0), Level.Type.Canyons, Content.Load<Texture2D>("backdrops/canyons"), levelTextureHandler.Load<Texture2D>("foregrounds/10-0"), cats, gems, obTextures);
            sr.Close();
            sr = new StreamReader("Content/levels/0-0.txt");
            levels[0, 0] = new Level(sr, new Vector2(0, 0), Level.Type.Final, Content.Load<Texture2D>("backdrops/final"), levelTextureHandler.Load<Texture2D>("pixel"), cats, gems, obTextures);
            sr.Close();
            sr.Dispose();

            currentLevel = levels[11, 0];
            previousLevel = levels[10, 0];
            LoadLevels();

            angel = new Angel(angelNormalTexture, angelFlyTexture, hitWall, flap, new Vector2(windowWidth / 2, 459));
            MediaPlayer.Volume = 0.85f;
            MediaPlayer.IsRepeating = true;
            ChangeSong();
        }
Exemple #12
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font = Content.Load<SpriteFont>("font");

            // Load sprites
            angelNormal[0] = Content.Load<Texture2D>("angel/angel normal 1");
            angelNormal[1] = Content.Load<Texture2D>("angel/angel normal 2");
            angelFly[0] = Content.Load<Texture2D>("angel/angel fly 1");
            angelFly[1] = Content.Load<Texture2D>("angel/angel fly 2");
            angelFly[2] = Content.Load<Texture2D>("angel/angel fly 3");

            catNormal[0] = catNormal[6] = Content.Load<Texture2D>("cat/cat normal 1");
            catNormal[1] = catNormal[5] = Content.Load<Texture2D>("cat/cat normal 2");
            catNormal[2] = catNormal[4] = Content.Load<Texture2D>("cat/cat normal 3");
            catNormal[3] = Content.Load<Texture2D>("cat/cat normal 4");
            catHit[0] = catHit[4] = Content.Load<Texture2D>("cat/cat hit 1");
            catHit[1] = catHit[3] = Content.Load<Texture2D>("cat/cat hit 2");
            catHit[2] = Content.Load<Texture2D>("cat/cat hit 3");
            catHit[5] = catHit[7] = Content.Load<Texture2D>("cat/cat hit 4");
            catHit[6] = Content.Load<Texture2D>("cat/cat hit 5");

            explosionTexture = Content.Load<Texture2D>("explosion particle");

            // Load backgrounds
            backgrounds[0] = Content.Load<Texture2D>("backdrops/canyons");
            backgrounds[2] = Content.Load<Texture2D>("backdrops/caves");
            backgrounds[3] = Content.Load<Texture2D>("backdrops/warzone");
            backgrounds[4] = Content.Load<Texture2D>("backdrops/frozenwasteland");
            backgrounds[5] = Content.Load<Texture2D>("backdrops/underwater");
            backgrounds[6] = Content.Load<Texture2D>("backdrops/underwater transition");
            //backgrounds[7] = Content.Load<Texture2D>("backdrops/fault line");

            // Load sounds and music
            hitWall = Content.Load<SoundEffect>("thump");
            flap = Content.Load<SoundEffect>("whoosh");
            meow = Content.Load<SoundEffect>("meow");

            // Load cats
            HUDCat = new Cat(Vector2.Zero, -1, null,
                new AnimatedTexture(catNormal, 4, false), new AnimatedTexture(catHit, 4, false), font);
            cats[0] = new Cat(Vector2.Zero, 0,
                "                  Welcome to Cat Planet 2!\n" +
                "This is an extra ammount of text to test my drawing method!\n" +
                "                          BEANS",
                new AnimatedTexture(catNormal, 4, false), new AnimatedTexture(catHit, 4, false), font);
            cats[1] = new Cat(Vector2.Zero, 1,
                "Double the cat planet!",
                new AnimatedTexture(catNormal, 4, false), new AnimatedTexture(catHit, 4, false), font);
            cats[2] = new Cat(Vector2.Zero, 2,
                "Idk!",
                new AnimatedTexture(catNormal, 4, false), new AnimatedTexture(catHit, 4, false), font);

            // Load levels
            levels[11, 0] = new Level(new Vector2(11, 0), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/11-0"), cats, obTextures);
            levels[11, 1] = new Level(new Vector2(11, 1), Level.Type.Canyons, backgrounds[0], Content.Load<Texture2D>("foregrounds/11-1"), cats, obTextures);

            currentLevel = levels[11, 0];
            previousLevel = levels[10, 0];
            angel = new Angel(angelNormal, angelFly, hitWall, flap, new Vector2(windowWidth / 2, windowHeight - 128));
        }