Exemple #1
0
        public Level(main main)
        {
            // should only be called by EditorLevel
            players = new List <Player>()
            {
                new Player(main.getSettings().getControlMode())
            };

            platforms = new List <Platform>()
            {
                new Platform(new Point(1000, 1000), 200),
                new Platform(new Point(1000, 800), 200)
            };

            foreach (Player p in players)
            {
                p.setLevel(this);
            }

            Sentry s = new Sentry(Sentry.Type.PUSH, 6);

            s.setPlatform(platforms.ElementAt(1));
            s.setLevel(this);

            sentries = new List <Sentry>()
            {
                s
            };

            this.animations = new List <Animation>();
            this.background = Render.initialBackground();
            this.camera     = new Camera(Camera.FollowMode.STEADY);
            this.main       = main;
        }
Exemple #2
0
        private void updateSelectionStats()
        {
            if (selected is Sentry)
            {
                Sentry s = (Sentry)selected;

                selectionStats = new string[] { "TYPE: " + Sentry.read(s.getType()),
                                                "SPEED: " + s.getSpeed(),
                                                "DIRECTION: " + s.interpretDirection(),
                                                "SECONDARY TYPE: " + Sentry.read(s.getSecondary()) };
            }
            else if (selected is Platform)
            {
                Platform p = (Platform)selected;

                selectionStats = new string[] { "WIDTH: " + p.getWidth() };
            }
        }
Exemple #3
0
        public static Bitmap sentry(Sentry sentry)
        {
            Color color = sentryColor(sentry);

            Bitmap bitmap = new Bitmap(20, 20);

            using (Graphics g = Graphics.FromImage(bitmap))
            {
                if (sentry.isAlive())
                {
                    g.FillRectangle(new SolidBrush(Color.FromArgb(0, 0, 0)), 0, 0, 20, 20);
                    g.FillRectangle(new SolidBrush(color), 3, 3, 14, 14);
                }
                else
                {
                    // g.FillRectangle(new SolidBrush(color), 0, 16, 20, 4);
                }
            }
            return(bitmap);
        }
Exemple #4
0
        public static Color sentryColor(Sentry sentry)
        {
            switch (sentry.getType())
            {
            case Sentry.Type.PUSH:
                return(Color.FromArgb(0, 0, 255));

            case Sentry.Type.SHOVE:
                return(Color.FromArgb(0, 0, 127));

            case Sentry.Type.PULL:
                return(Color.FromArgb(100, 255, 255));

            case Sentry.Type.DROP:
                return(Color.FromArgb(120, 0, 0));

            case Sentry.Type.HORZ_MAGNET:
                return(Color.FromArgb(255, 100, 255));

            case Sentry.Type.GRAV_FLIP:
                return(Color.FromArgb(127, 255, 127));

            case Sentry.Type.GRAV_DOUBLE:
                return(Color.FromArgb(255, 127, 127));

            case Sentry.Type.MOVE:
                return(Color.FromArgb(0, 255, 0));

            case Sentry.Type.DECAY:
                return(Color.FromArgb(255, 255, 0));

            case Sentry.Type.FLEE:
                return(Color.FromArgb(255, 255, 255));

            case Sentry.Type.SPREAD:
                return(Color.FromArgb(0, 151, 151));

            case Sentry.Type.EXPAND:
                return(Color.FromArgb(255, 100, 0));

            case Sentry.Type.SPAWN:
                return(Color.FromArgb(150, 100, 0));

            case Sentry.Type.GRAV_RED:
                return(Color.FromArgb(100, 100, 255));

            case Sentry.Type.GRAV_INC:
                return(Color.FromArgb(255, 255, 127));

            case Sentry.Type.GOD:
                return(Color.FromArgb(150, 0, 150));

            case Sentry.Type.RANDOM:
                return(Color.FromArgb(20, 20, 20));

            case Sentry.Type.NECROMANCER:
                return(Color.FromArgb(160, 160, 160));

            default:
                return(Color.FromArgb(0, 0, 0));
            }
        }
Exemple #5
0
        public static Level readFromFile(String file, Player[] players,
                                         Camera.FollowMode followMode, main main)
        {
            // SETUP
            string[] lines     = File.ReadAllLines(file);
            int      platformc = Int32.Parse(
                lines[0].Substring(0, lines[0].IndexOf(" ")));
            int sentryc = Int32.Parse(
                lines[0].Substring(lines[0].IndexOf(" ") + 1));

            Platform[] platforms = new Platform[platformc];
            Sentry[]   sentries  = new Sentry[sentryc];
            int[]      key       = new int[sentryc];

            // NAME
            String name = lines[1];

            // PLATFORMS
            int l = 2;

            for (int i = 0; i < platformc; i++)
            {
                string line = lines[l + i];

                int x = Int32.Parse(line.Substring(0, line.IndexOf(" ")));
                line = line.Substring(line.IndexOf(" ") + 1);
                int y = Int32.Parse(line.Substring(0, line.IndexOf(" ")));
                line = line.Substring(line.IndexOf(" ") + 1);
                int w = Int32.Parse(line);
                platforms[i] = new Platform(new Point(x, y), w);
            }

            l += platformc;

            // NOTE
            String note = lines[l];

            // SENTRIES
            l++;

            for (int i = 0; i < sentryc; i++)
            {
                string line = lines[l + i];

                Enum.TryParse(line.Substring(0, line.IndexOf(" ")),
                              out Sentry.Type type);
                line = line.Substring(line.IndexOf(" ") + 1);
                int speed = Int32.Parse(line.Substring(0, line.IndexOf(" ")));
                line = line.Substring(line.IndexOf(" ") + 1);
                Enum.TryParse(line.Substring(0, line.IndexOf(" ")),
                              out Sentry.Type secondary);

                if (type == Sentry.Type.SPAWN)
                {
                    sentries[i] = new Sentry(type, speed, secondary);
                }
                else
                {
                    sentries[i] = new Sentry(type, speed);
                }

                line = line.Substring(line.IndexOf(" ") + 1);

                key[i] = Int32.Parse(line);
            }

            return(new Level(players, platforms, sentries,
                             key, followMode, main, name, note));
        }
Exemple #6
0
        public static Level fetchLevel(String id, int playerc,
                                       Camera.FollowMode followMode, main main)
        {
            Debug.Assert(playerc == 1 || playerc == 2);

            Player[]   players;
            Platform[] platforms = new Platform[] { new Platform(new Point(1000, 1000), 200) };
            Sentry[]   sentries  = new Sentry[] { };
            int[]      key       = new int[] { };

            if (playerc == 2)
            {
                players = new Player[] { new Player(main.getSettings().getControlMode()),
                                         new Player((GameSettings.ControlMode)(1 -
                                                                               (int)main.getSettings().getControlMode())) };
            }
            else
            {
                players = new Player[] { new Player(main.getSettings().getControlMode()) };
            }

            switch (id)
            {
            case "staircase1":
                platforms = new Platform[] {
                    new Platform(new Point(1000, 1000), 200),
                    new Platform(new Point(800, 900), 200),
                    new Platform(new Point(1200, 800), 200),
                    new Platform(new Point(800, 700), 200),
                    new Platform(new Point(1200, 600), 200),
                    new Platform(new Point(800, 500), 200)
                };
                sentries = new Sentry[] {
                    new Sentry(Sentry.Type.PUSH, 10),
                    new Sentry(Sentry.Type.SPAWN, -10),
                    new Sentry(Sentry.Type.RANDOM, 14)
                };
                key = new int[] { 1, 2, 4 };
                break;

            case "behemoth":
                platforms = new Platform[] {
                    new Platform(new Point(1100, 1250), 100),
                    new Platform(new Point(700, 1150), 200),
                    new Platform(new Point(1150, 1075), 100),
                    new Platform(new Point(1000, 1000), 150),
                    new Platform(new Point(650, 1000), 200),
                    new Platform(new Point(1350, 1000), 150),
                    new Platform(new Point(850, 925), 100),
                    new Platform(new Point(1300, 850), 200),
                    new Platform(new Point(900, 750), 100)
                };
                sentries = new Sentry[] {
                    new Sentry(Sentry.Type.GRAV_DOUBLE, 10),
                    new Sentry(Sentry.Type.MOVE, 14),
                    new Sentry(Sentry.Type.GRAV_INC, 10),
                    new Sentry(Sentry.Type.GRAV_RED, -10),
                    new Sentry(Sentry.Type.GRAV_FLIP, -10),
                    new Sentry(Sentry.Type.PULL, 12)
                };
                key = new int[] { 1, 3, 4, 5, 7, 8 };
                break;

            case "Take Flight":
                platforms = new Platform[] {
                    new Platform(new Point(1100, 1250), 100),
                    new Platform(new Point(700, 1150), 200),
                    new Platform(new Point(2000, 1000), 150)
                };
                sentries = new Sentry[] {
                    new Sentry(Sentry.Type.GRAV_DOUBLE, 10),
                    new Sentry(Sentry.Type.DECAY, 14)
                };
                key = new int[] { 1, 2 };
                break;

            default:
                String file = "../../Resources/" + id + ".txt";
                return(readFromFile(file, players, followMode, main));
            }
            return(new Level(players, platforms, sentries, key, followMode, main));
        }
Exemple #7
0
        private void hovering()
        {
            Point       l       = mover.getLocation();
            bool        found   = false;
            HasLocation hovered = null;

            // Player check
            if (Math.Abs(l.X - players.ElementAt(0).getLocation().X) <= 10 &&
                Math.Abs(l.Y - players.ElementAt(0).getLocation().Y) <= 10)
            {
                found   = true;
                hovered = players.ElementAt(0);
            }

            // Platform check
            for (int i = 0; i < platforms.Count && !found; i++)
            {
                Point p = platforms.ElementAt(i).getLocation();
                int   w = platforms.ElementAt(i).getWidth() / 2;

                if (Math.Abs(l.X - p.X) < w && Math.Abs(l.Y - p.Y) <= 10)
                {
                    hovered = platforms.ElementAt(i);
                    found   = true;
                    break;
                }
            }

            if (!found)
            {
                foreach (Sentry s in sentries)
                {
                    if (Math.Abs(l.X - s.getLocation().X) <= 10 &&
                        Math.Abs(l.Y - s.getLocation().Y) <= 10)
                    {
                        hovered = s;
                        found   = true;
                        break;
                    }
                }
            }

            if (found)
            {
                if (hovered is Player)
                {
                    crossHairColor = Color.FromArgb(255, 0, 0);
                    updateSelectionContext(
                        "<Player spawn is linked to starting platform>",
                        new string[0]);
                }
                else
                {
                    crossHairColor = Color.FromArgb(0, 255, 0);
                    selectable     = hovered;

                    if (hovered is Sentry)
                    {
                        Sentry s = (Sentry)hovered;
                        updateSelectionContext(
                            "<" + controls[6] + "> to select - SENTRY " +
                            (sentries.IndexOf(s) + 1),
                            new string[] { "TYPE: " + Sentry.read(s.getType()),
                                           "SPEED: " + s.getSpeed(),
                                           "DIRECTION: " + s.interpretDirection(),
                                           "SECONDARY TYPE: " +
                                           Sentry.read(s.getSecondary()) });
                    }

                    if (hovered is Platform)
                    {
                        Platform p      = (Platform)hovered;
                        int      pIndex = platforms.IndexOf(p);

                        switch (pIndex)
                        {
                        case 0:
                            updateSelectionContext(
                                "<" + controls[6] +
                                "> to select - STARTING PLATFORM",
                                new string[] { "WIDTH: " + p.getWidth() });
                            break;

                        default:
                            updateSelectionContext(
                                "<" + controls[6] +
                                "> to select - PLATFORM " + (pIndex + 1),
                                new string[] { "WIDTH: " + p.getWidth() });
                            break;
                        }
                    }
                }
            }
            else
            {
                selectable = null;
                updateSelectionContext(" ", new string[0]);
                crossHairColor = Color.FromArgb(155, 155, 155);
            }
        }
Exemple #8
0
        public new void keyHandler(KeyEventArgs e, bool down)
        {
            // Key status
            if (e.KeyCode == controls[4])
            {
                is4Down = down;
            }
            else if (e.KeyCode == controls[5])
            {
                is5Down = down;
            }
            else if (e.KeyCode == Keys.Up)
            {
                arrowDown[UP] = down;
            }
            else if (e.KeyCode == Keys.Down)
            {
                arrowDown[DOWN] = down;
            }
            else if (e.KeyCode == Keys.Left)
            {
                arrowDown[LEFT] = down;
            }
            else if (e.KeyCode == Keys.Right)
            {
                arrowDown[RIGHT] = down;
            }

            // TODO
            if (!down)
            {
                // Test
                if (e.KeyCode == Keys.T)
                {
                    main.playEditorLevel();
                }
                else if (e.KeyCode == Keys.R)
                {
                    main.resetEditor();
                }
                else if (e.KeyCode == Keys.F)
                {
                    main.setMode(Mode.MENU);
                    main.setMenuFrame("editor-level-finish");
                }

                switch (selectionMode)
                {
                case SelectionMode.CAN_ADD:
                    if (e.KeyCode == controls[4])
                    {
                        platforms.Add(new Platform(
                                          mover.getLocation(), 200));
                    }
                    break;

                case SelectionMode.REG_PLATFORM:
                    Platform p = (Platform)selected;
                    if (e.KeyCode == Keys.Back)
                    {
                        // Delete platform
                        platforms.Remove(p);

                        for (int i = 0; i < sentries.Count; i++)
                        {
                            Sentry sentry = sentries.ElementAt(i);
                            if (sentry.getPlatform() == p)
                            {
                                sentries.Remove(sentry);
                                i--;
                            }
                        }

                        selected      = null;
                        selectionMode = SelectionMode.NONE;
                    }
                    else if (e.KeyCode == Keys.X)
                    {
                        // Add sentry
                        Sentry sentry = new Sentry(Sentry.Type.RANDOM,
                                                   6, Sentry.Type.RANDOM);
                        sentries.Add(sentry);
                        sentry.setPlatform(p);
                    }
                    break;

                case SelectionMode.SENTRY:
                    Sentry s = (Sentry)selected;
                    if (e.KeyCode == controls[4])
                    {
                        // Next type - cycles through the enum
                        s.nextType();
                    }
                    else if (e.KeyCode == controls[5])
                    {
                        // Next secondary
                        s.nextSecondary();
                    }
                    else if (e.KeyCode == Keys.Left)
                    {
                        s.setDirection(-1);
                    }
                    else if (e.KeyCode == Keys.Right)
                    {
                        s.setDirection(1);
                    }
                    else if (e.KeyCode == Keys.Up && s.getSpeed() < 14)
                    {
                        s.changeSpeed(2);
                    }
                    else if (e.KeyCode == Keys.Down && s.getSpeed() > 2)
                    {
                        s.changeSpeed(-2);
                    }
                    else if (e.KeyCode == Keys.Back)
                    {
                        sentries.Remove(s);

                        selected      = null;
                        selectionMode = SelectionMode.NONE;
                    }
                    break;
                }
            }

            if (down)
            {
                if (e.KeyCode == controls[6])
                {
                    if (selectable != null)
                    {
                        selected   = selectable;
                        selectable = null;

                        if (selected is Sentry)
                        {
                            selectionMode    = SelectionMode.SENTRY;
                            selectionContext = "SENTRY " +
                                               (sentries.IndexOf((Sentry)selected) + 1);
                        }
                        else if (selected is Platform)
                        {
                            Platform p = (Platform)selected;

                            if (platforms.IndexOf(p) == 0)
                            {
                                selectionMode =
                                    SelectionMode.STARTING_PLATFORM;
                                selectionContext = "STARTING PLATFORM";
                            }
                            else
                            {
                                selectionMode    = SelectionMode.REG_PLATFORM;
                                selectionContext = "PLATFORM " +
                                                   (platforms.IndexOf(p) + 1);
                            }
                        }
                    }
                    else if (selected != null)
                    {
                        selected      = null;
                        selectionMode = SelectionMode.NONE;
                    }
                }
            }

            if (selected != null)
            {
                updateSelectionStats();
            }

            mover.keyHandler(e, down);
        }
Exemple #9
0
 public void addSentry(Sentry sentry)
 {
     sentries.Add(sentry);
     sentry.setLevel(this);
 }
Exemple #10
0
        public Bitmap render()
        {
            Bitmap render = new Bitmap(1280, 720);

            using (Graphics g = Graphics.FromImage(render))
            {
                // Background
                g.DrawImage(background, 0, 0);

                // SETUP
                Point c = camera.getLocation();
                Point o = new Point(640 - c.X, 360 - c.Y);
                bool  z = camera.isZoomedOut();
                int   d = 1;
                if (z)
                {
                    d = 2;
                }

                // Animations
                foreach (Animation animation in animations)
                {
                    Point a = animation.getLocation();

                    switch (animation.getPermanence())
                    {
                    case Animation.Permanence.PERMANENT:
                        Bitmap image = animation.getBitmap();
                        g.DrawImage(image,
                                    640 + (((o.X + a.X - (image.Size.Width / 2)) - 640) / d),
                                    360 + (((o.Y + a.Y - (image.Size.Height / 2)) - 360) / d),
                                    image.Width / d, image.Height / d);
                        break;

                    case Animation.Permanence.TEMPORARY:
                        int age  = animation.getAge();
                        int size = 4 * age;
                        g.FillRectangle(new SolidBrush(
                                            Color.FromArgb(120 - (15 * age), animation.getColor())),
                                        640 + (((o.X + a.X - (size / 2)) - 640) / d),
                                        360 + (((o.Y + a.Y - (size / 2)) - 360) / d),
                                        size / d, size / d);
                        break;
                    }
                }

                // Platforms
                foreach (Platform platform in platforms)
                {
                    g.DrawImage(Render.platform(platform),
                                640 + (((o.X + platform.getLocation().X - (int)(platform.getWidth() / 2)) - 640) / d),
                                360 + (((o.Y + platform.getLocation().Y - 10) - 360) / d),
                                platform.getWidth() / d, 20 / d);
                }

                // Sentries
                foreach (Sentry sentry in sentries)
                {
                    Point s = sentry.getLocation();

                    if (sentry.isAlive() && sentry.sightDependent())
                    {
                        int a = 50;

                        if (sentry.seesPlayer() != null)
                        {
                            a += 100;
                        }

                        if (sentry.getDirection() == -1)
                        {
                            g.FillRectangle(new SolidBrush(
                                                Color.FromArgb(a,
                                                               Render.sentryColor(sentry))),
                                            0, 360 + (((o.Y + s.Y - 7) - 360) / d),
                                            640 + (((o.X + s.X - 10) - 640) / d), 14 / d);
                        }
                        else
                        {
                            g.FillRectangle(new SolidBrush(
                                                Color.FromArgb(a,
                                                               Render.sentryColor(sentry))),
                                            640 + (((o.X + s.X + 10) - 640) / d),
                                            360 + (((o.Y + s.Y - 7) - 360) / d),
                                            1280 - (640 + (((o.X + s.X - 10) - 640) / d)), 14 / d);
                        }
                    }
                    else if (sentry.isAlive())
                    {
                        g.FillEllipse(new SolidBrush(
                                          Color.FromArgb(100,
                                                         Render.sentryColor(sentry))),
                                      640 + (((o.X + s.X - 20) - 640) / d),
                                      360 + (((o.Y + s.Y - 20) - 360) / d), 40 / d, 40 / d);
                    }

                    g.DrawImage(Render.sentry(sentry),
                                640 + (((o.X + s.X - 10) - 640) / d),
                                360 + (((o.Y + s.Y - 10) - 360) / d), 20 / d, 20 / d);

                    if (sentry.getType() == Sentry.Type.NECROMANCER && sentry.isAlive())
                    {
                        Sentry pretend = new Sentry(Sentry.Type.RANDOM, 0);
                        int    size    = (int)(10 / (100 / (float)sentry.getCount()));
                        g.DrawImage(Render.sentry(pretend),
                                    640 + (((o.X + s.X - (size / 2)) - 640) / d),
                                    360 + (((o.Y + s.Y - (size / 2)) - 360) / d),
                                    size / d, size / d);
                    }

                    if (sentry.getType() == Sentry.Type.SPAWN && sentry.isAlive())
                    {
                        if (sentry.getCount() % 10 >= 7)
                        {
                            Sentry pretend = new Sentry(sentry.getSecondary(), 0);
                            g.DrawImage(Render.sentry(pretend),
                                        640 + (((o.X + s.X - 10) - 640) / d),
                                        360 + (((o.Y + s.Y - 10) - 360) / d), 20 / d, 20 / d);
                        }
                    }
                }

                // Player(s)
                foreach (Player player in players)
                {
                    Point l  = player.getLocation();
                    Point sl = player.getSaveLocation();

                    // saved location
                    g.FillRectangle(new SolidBrush(Color.FromArgb(100, 155, 0, 0)),
                                    640 + (((o.X + sl.X - 5) - 640) / d),
                                    360 + (((o.Y + sl.Y - 5) - 360) / d), 10 / d, 10 / d);

                    // teleportation shadow
                    if (player.getTelePhase() > 0)
                    {
                        g.FillRectangle(new SolidBrush(Color.FromArgb(100, 255, 0, 0)),
                                        640 + (((o.X + l.X - 5 + (5 * player.getDirection() *
                                                                  player.getTelePhase() * player.getSpeed())) - 640) / d),
                                        360 + (((o.Y + l.Y - 5) - 360) / d), 10 / d, 10 / d);
                    }

                    // location
                    g.DrawImage(Render.player(),
                                640 + (((o.X + l.X - 10) - 640) / d),
                                360 + (((o.Y + l.Y - 10) - 360) / d), 20 / d, 20 / d);
                }

                // HUD Elements
                foreach (HUDElement element in elements)
                {
                    Bitmap h     = element.draw();
                    Point  hSpot = element.getLocation();

                    switch (element.alignment)
                    {
                    case HUDElement.Alignment.CENTER:
                        switch (element.cameraDep)
                        {
                        case false:
                            g.DrawImage(h, hSpot.X - (h.Width / 2),
                                        hSpot.Y - (h.Height / 2));
                            break;

                        case true:
                        default:
                            int x = 640 + ((o.X + hSpot.X -
                                            (h.Width / 2) - 640) / d);
                            int y = 360 + ((o.Y + hSpot.Y -
                                            (h.Height / 2) - 360) / d);
                            g.DrawImage(h, x, y);
                            break;
                        }
                        break;

                    case HUDElement.Alignment.LEFT:
                        g.DrawImage(h, hSpot.X,
                                    hSpot.Y - (h.Height / 2));
                        break;

                    case HUDElement.Alignment.RIGHT:
                        g.DrawImage(h, hSpot.X - h.Width,
                                    hSpot.Y - (h.Height / 2));
                        break;

                    case HUDElement.Alignment.LEFT_TOP:
                        g.DrawImage(h, hSpot.X, hSpot.Y);
                        break;

                    case HUDElement.Alignment.RIGHT_TOP:
                        g.DrawImage(h, hSpot.X - h.Width, hSpot.Y);
                        break;
                    }
                }
            }

            return(render);
        }
Exemple #11
0
        public void behave()
        {
            Player          sees      = null;
            List <Platform> platforms = level.getPlatforms();

            if (sightDependent())
            {
                // SIGHT-DEPENDENT
                sees = seesPlayer();

                if (sees != null)
                {
                    switch (type)
                    {
                    case Type.PUSH:
                        sees.moveX(speed * direction);
                        break;

                    case Type.SHOVE:
                        sees.moveX(4 * speed * direction);
                        break;

                    case Type.PULL:
                        sees.moveX(-speed * direction);
                        break;

                    case Type.DROP:
                        sees.moveY(21);
                        break;

                    case Type.GRAV_FLIP:
                        sees.mulGAcceleration(-1);
                        break;

                    case Type.GRAV_DOUBLE:
                        sees.mulGAcceleration(2);
                        break;

                    case Type.MOVE:
                        platform.moveX(-(speed * direction));
                        break;

                    case Type.DECAY:
                        if (platform.getWidth() > 20)
                        {
                            platform.changeWidth(-speed);
                            platform.moveX(direction * (-speed / 2));
                        }
                        break;

                    case Type.SPREAD:
                        if (platform.getWidth() < 500)
                        {
                            platform.changeWidth(speed);
                        }
                        break;

                    case Type.EXPAND:
                        foreach (Platform p in level.getPlatforms())
                        {
                            if (p != platform)
                            {
                                p.moveX(speed * Math.Sign(
                                            p.getLocation().X - platform.getLocation().X));
                                p.moveY((speed / 2) * Math.Sign(
                                            p.getLocation().Y - platform.getLocation().Y));
                            }
                        }
                        foreach (Sentry s in level.getSentries())
                        {
                            if (s != this)
                            {
                                s.fix();
                            }
                        }
                        break;

                    case Type.FLEE:
                        int i = 0;
                        while (i == 0 || platforms.ElementAt(i) == platform)
                        {
                            Random rnd = new Random(Guid.NewGuid().GetHashCode());
                            i = rnd.Next(1, platforms.Count);
                        }
                        setPlatform(platforms.ElementAt(i));
                        break;

                    case Type.GOD:
                        int seesY = sees.getLocation().Y;

                        List <Player>    players    = level.getPlayers();
                        List <Sentry>    sentries   = level.getSentries();
                        List <Animation> animations = level.getAnimations();
                        foreach (Player p in players)
                        {
                            p.setY(-1 * p.getLocation().Y);
                            p.setSY(-1 * p.getSaveLocation().Y);
                            p.mulGAcceleration(-1);
                        }

                        foreach (Platform p in platforms)
                        {
                            p.setY(-1 * p.getLocation().Y);
                        }

                        foreach (Sentry s in sentries)
                        {
                            s.location.Y *= -1;
                            s.location.Y -= 40;
                        }

                        foreach (Animation a in animations)
                        {
                            a.setY(-1 * a.getLocation().Y);
                        }

                        int o = seesY - sees.getLocation().Y;

                        foreach (Player p in players)
                        {
                            p.moveY(o);
                            p.moveSY(o);
                        }

                        foreach (Platform p in platforms)
                        {
                            p.moveY(o);
                        }

                        foreach (Sentry s in sentries)
                        {
                            s.location.Y += o;
                        }

                        foreach (Animation a in animations)
                        {
                            a.moveY(o);
                        }

                        break;

                    default:
                        // TODO
                        break;
                    }
                }
            }
            else
            {
                // TODO: NON- SIGHT-DEPENDENT
                List <Player> players = level.getPlayers();

                switch (type)
                {
                case Type.GRAV_INC:
                    foreach (Player player in players)
                    {
                        player.changeGAcceleration(-3);
                    }
                    break;

                case Type.GRAV_RED:
                    foreach (Player player in players)
                    {
                        player.changeGAcceleration(3);
                    }
                    break;

                case Type.HORZ_MAGNET:
                    foreach (Player player in players)
                    {
                        player.moveX(speed * Math.Sign(location.X -
                                                       player.getLocation().X));
                    }
                    break;

                case Type.SPAWN:
                    count++;
                    count %= 100;

                    // UPDATE CHILDREN
                    for (int i = 0; i < children.Count; i++)
                    {
                        if (!children.ElementAt(i).isAlive())
                        {
                            children.RemoveAt(i);
                            i--;
                        }
                    }

                    // SPAWN LOGIC
                    if (count == 0 && children.Count < 5)
                    {
                        Random sp         = new Random(Guid.NewGuid().GetHashCode());
                        int    childSpeed = sp.Next(1, 8) * 2;

                        Sentry child = new Sentry(secondary, childSpeed);
                        children.Add(child);
                        level.addSentry(child);
                        int i = 0;
                        while (i == 0 || platforms.ElementAt(i) == platform)
                        {
                            Random rnd = new Random(Guid.NewGuid().GetHashCode());
                            i = rnd.Next(1, platforms.Count);
                        }
                        child.setPlatform(platforms.ElementAt(i));
                    }
                    break;

                case Type.NECROMANCER:
                    count++;
                    count %= 100;

                    // REANIMATION LOGIC
                    if (count == 0)
                    {
                        for (int i = 0; i < level.getSentries().Count; i++)
                        {
                            Sentry s = level.getSentries().ElementAt(i);
                            if (!s.alive && s != this)
                            {
                                s.alive = true;
                                children.Add(s);
                                break;
                            }
                        }
                    }
                    break;

                case Type.RANDOM:
                    // RESOLVE to another type
                    while (type == Type.RANDOM)
                    {
                        Random random = new Random(Guid.NewGuid().GetHashCode());
                        type = (Type)random.Next(0, NUM_TYPES);
                    }

                    if (type == Type.SPAWN || type == Type.NECROMANCER)
                    {
                        children  = new List <Sentry>();
                        count     = 0;
                        secondary = Type.RANDOM;
                    }
                    break;

                default:
                    // TODO
                    break;
                }
            }
        }