Ejemplo n.º 1
0
        public void draw(PaintEventArgs e, Player player, World w)
        {
            if (doorForKey.locked)
            {
                if (color == Stat.Red)  //depending on key colour
                {
                    e.Graphics.DrawImage(Properties.Resources.keyRed, rect);    //Draw different Key Image
                }
                if (color == Stat.Blue)
                {
                    e.Graphics.DrawImage(Properties.Resources.keyBlue, rect);
                }
                if (color == Stat.Green)
                {
                    e.Graphics.DrawImage(Properties.Resources.keyGreen, rect);
                }
                if (color == Stat.Gold)
                {
                    e.Graphics.DrawImage(Properties.Resources.keyGold, rect);
                }

                if (player.xPos + player.size > xPos && player.xPos < xPos + width &&  //Player collides with key
                    player.yPos + player.size > yPos && player.yPos < yPos + height ||
                    initially)
                {
                    doorForKey.toggleLocked(w, this);
                    initially = false;
                }
            }
        }
Ejemplo n.º 2
0
Archivo: Door.cs Proyecto: Jkoza/Vanish
        public void draw(PaintEventArgs e, Player player, Tile[,] grid)
        {
            if (!locked)    //if unlocked, use default gray door colour
            {
                brush = new SolidBrush(Color.FromArgb(175, Stat.Black));
            }
            e.Graphics.FillRectangle(brush, rect);

            if (sliding)
            {
                slide();  //continue slide animation every timer tick...
            } //Check Door Proximity
            else if (shouldSlide(player, grid))  //if it should slide
            {
                startSlide(); //start slide animation
            }
        }
Ejemplo n.º 3
0
        //PLAYER INTERCEPTING TILES/DOORS   (Doors are technically a workaround in which walls are drawn beneath locked doors so you cannot walk through them)
        public void PlayerTiles(Player player, Tile[,] grid)
        {
            bool noneUp = true;
            bool noneDown = true;
            bool noneLeft = true;
            bool noneRight = true;
            foreach (Tile t in grid)
            {
                if (t.initialized)  //if a wall
                {
                    double xPosP = player.xPos + (player.size / 2); //new CENTRED position vars
                    double yPosP = player.yPos + (player.size / 2);
                    double xPosT = t.loc.X + (Stat.TileSize / 2);
                    double yPosT = t.loc.Y + (Stat.TileSize / 2);
                    double overcomeDist = (player.size + Stat.TileSize) / 2;

                    if (player.yPos <= 0 ||
                        yPosT - yPosP >= -overcomeDist && yPosT - yPosP <= 0 &&    //tile above
                        xPosT - xPosP <= (overcomeDist / 2) && xPosT - xPosP >= -(overcomeDist / 2))
                    {
                        player.upC = false;   //can't move up
                        noneUp = false;
                    }
                    if (player.yPos + player.size >= Stat.pbCanvasHeight ||
                        yPosT - yPosP <= overcomeDist && yPosT - yPosP >= 0 &&    //tile below
                        xPosT - xPosP <= (overcomeDist / 2) && xPosT - xPosP >= -(overcomeDist / 2))
                    {
                        player.downC = false;   //can't move down
                        noneDown = false;
                    }
                    if (player.xPos <= 0 ||
                        xPosT - xPosP >= -overcomeDist && xPosT - xPosP <= 0 &&    //tile on left
                        yPosT - yPosP <= (overcomeDist / 2) && yPosT - yPosP >= -(overcomeDist / 2))
                    {
                        player.leftC = false;   //can't move left
                        noneLeft = false;
                    }
                    if (player.xPos + player.size >= Stat.pbCanvasWidth ||
                        xPosT - xPosP <= overcomeDist && xPosT - xPosP >= 0 &&    //tile on right
                        yPosT - yPosP <= (overcomeDist / 2) && yPosT - yPosP >= -(overcomeDist / 2))
                    {
                        player.rightC = false;   //can't move right
                        noneRight = false;
                    }
                }
            }

            if (noneUp)     //if none in the way, let it pass through IF player.up == true also
            {
                player.upC = true;
            }
            if (noneDown)
            {
                player.downC = true;
            }
            if (noneLeft)
            {
                player.leftC = true;
            }
            if (noneRight)
            {
                player.rightC = true;
            }
        }
Ejemplo n.º 4
0
        //PLAYER PULSE INTERCEPTING ENEMY EARSHOT
        public void PlayerPulseEnemyHearing(Player player, List<Enemy> enemy, World w)
        {
            double dx, dy;
            double radiiP;
            if (!w.gameWon)
            {
                foreach (Enemy e in enemy)
                {
                    if (player.moving && e.hearing) //if the player is moving and enemy can hear
                    {
                        dx = player.xPos - e.xPos;
                        dy = player.yPos - e.yPos;
                        radiiP = ((player.pulse / 2) + (e.hearDist / 2));

                        //pulse collision
                        if (Math.Sqrt(Math.Pow(dx, 2) + Math.Pow(dy, 2)) <= radiiP) //pulses collide
                        {
                            w.gameLost = true;
                            e.caughtPlayer = true;
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 5
0
 //PLAYER AND EXIT
 public void PlayerExit(Player player, Exit exit, World w)
 {
     if (player.xPos >= exit.xPos - 10 && player.xPos + player.size <= exit.xPos + exit.width + 10 &&    //check if player intersects with exit
         player.yPos >= exit.yPos - 10 && player.yPos + player.size <= exit.yPos + exit.height + 10) //10 pixel buffer
     {
         w.gameWon = true;
     }
 }
Ejemplo n.º 6
0
        public void PlayerEnemySight(Player player, List<Enemy> enemy, World w)
        {
            bool noneUp = false;
            bool noneDown = false;
            bool noneLeft = false;
            bool noneRight = false;
            if (!w.gameWon)
            {
                foreach (Enemy e in enemy)
                {
                    if (player.mode != "vanish")    //player/enemy sight intersect does not apply to 'Vanish' mode
                    {
                        //for UP
                        if (e.sightDir == "up" &&
                            player.yPos + player.size > e.sightPoints[1].Y && player.yPos + player.size < e.sightPoints[0].Y && //in between enemy and end of sightline on the X
                            player.xPos < e.sightPoints[0].X - ((player.yPos - e.sightPoints[0].Y) / 3) && player.xPos > e.sightPoints[0].X + ((player.yPos - e.sightPoints[0].Y) / 3))
                        {
                            w.gameLost = true;
                            e.caughtPlayer = true;
                        }
                        //for DOWN
                        if (e.sightDir == "down" &&
                            player.yPos < e.sightPoints[1].Y && player.yPos > e.sightPoints[0].Y && //in between enemy and end of sightline on the X
                            player.xPos + player.size > e.sightPoints[0].X - ((player.yPos - e.sightPoints[0].Y) / 3) && player.xPos + player.size < e.sightPoints[0].X + ((player.yPos - e.sightPoints[0].Y) / 3))
                        {
                            w.gameLost = true;
                            e.caughtPlayer = true;
                        }

                        //for LEFT
                        if (e.sightDir == "left" &&
                            player.xPos + player.size > e.sightPoints[1].X && player.xPos + player.size < e.sightPoints[0].X && //in between enemy and end of sightline on the X
                            player.yPos + player.size < e.sightPoints[0].Y - ((player.xPos - e.sightPoints[0].X) / 3) && player.yPos + player.size > e.sightPoints[0].Y + ((player.xPos - e.sightPoints[0].X) / 3))
                        {
                            w.gameLost = true;
                            e.caughtPlayer = true;
                        }
                        //for RIGHT
                        if (e.sightDir == "right" &&
                            player.xPos < e.sightPoints[1].X && player.xPos > e.sightPoints[0].X && //in between enemy and end of sightline on the X
                            player.yPos > e.sightPoints[0].Y - ((player.xPos - e.sightPoints[0].X) / 3) && player.yPos < e.sightPoints[0].Y + ((player.xPos - e.sightPoints[0].X) / 3))
                        {
                            w.gameLost = true;
                            e.caughtPlayer = true;
                        }

                        if (noneUp)
                        {
                            e.sightDist = e.SIGHT_DIST;
                        }
                        if (noneDown)
                        {
                            e.sightDist = e.SIGHT_DIST;
                        }
                        if (noneLeft)
                        {
                            e.sightDist = e.SIGHT_DIST;
                        }
                        if (noneRight)
                        {
                            e.sightDist = e.SIGHT_DIST;
                        }

                        e.drawRect();
                    }
                }
            }
        }
Ejemplo n.º 7
0
        //LEVEL 4 ****
        public void Level_4()
        {
            timeLimit = (int)(45 / Stat.difficulty);
            time = timeLimit;

            //Initialize player *
            player = new Player(playerColor, new Point(6 * Stat.TileSize, 58 * Stat.TileSize));

            //start
            drawFrom(new Point(1, 62), new Point(12, 62));  //bottom part   (also bottom of last hall)
            drawFrom(new Point(1, 55), new Point(1, 61)); //left wall
            drawFrom(new Point(12, 55), new Point(12, 61));  //right wall
            drawFrom(new Point(1, 55), new Point(12, 55)); //top part
            exclude(new Point(3, 55), new Point(10, 55)); // opening in top
            doors.Add(new Door(3, 55, false, -1, 8, false));

            //start strip
            //vertical
            drawFrom(new Point(2, 16), new Point(2, 54));
            drawFrom(new Point(11, 16), new Point(11, 54));
            exclude(new Point(11, 24), new Point(11, 29));
            drawFrom(new Point(2, 16), new Point(11, 16));
            //horizontal
            drawFrom(new Point(11, 23), new Point(26, 23));
            drawFrom(new Point(11, 30), new Point(26, 30));
            doors.Add(new Door(26, 24, true, -1, 6, false));

            //middle zone
            //vert left
            drawFrom(new Point(26, 18), new Point(26, 35));
            exclude(new Point(26, 24), new Point(26, 29));
            //horizontal
            drawFrom(new Point(26, 18), new Point(58, 18));
            drawFrom(new Point(26, 36), new Point(58, 36));
            //vert right
            drawFrom(new Point(58, 18), new Point(58, 35));
            exclude(new Point(58, 24), new Point(58, 29));
            //middle block
            drawFrom(new Point(34, 26), new Point(49, 26));
            drawFrom(new Point(34, 27), new Point(49, 27));
            exclude(new Point(40, 26), new Point(43, 26));
            exclude(new Point(40, 27), new Point(43, 27));

            //hallway
            //middle zone zone exit
            drawFrom(new Point(58, 23), new Point(63, 23));
            drawFrom(new Point(58, 30), new Point(63, 30));
            //vert left
            drawFrom(new Point(63, 12), new Point(63, 44));
            exclude(new Point(63, 24), new Point(63, 29));
            //vert right
            drawFrom(new Point(73, 5), new Point(73, 55));
            exclude(new Point(73, 24), new Point(73, 29));
            //key hole
            drawFrom(new Point(73, 23), new Point(79, 23));
            drawFrom(new Point(73, 30), new Point(79, 30));
            drawFrom(new Point(79, 23), new Point(79, 30));

            //bottom zone
            //entrance
            drawFrom(new Point(58, 44), new Point(63, 44));
            drawFrom(new Point(58, 55), new Point(73, 55));
            //horizontal
            drawFrom(new Point(20, 38), new Point(58, 38));
            drawFrom(new Point(20, 62), new Point(58, 62));
            //vert right
            drawFrom(new Point(58, 38), new Point(58, 62));
            exclude(new Point(58, 45), new Point(58, 54));
            //vert left
            drawFrom(new Point(20, 38), new Point(20, 62));
            exclude(new Point(20, 45), new Point(20, 54));
            //pillar 1
            drawFrom(new Point(32, 38), new Point(32, 62));
            exclude(new Point(32, 45), new Point(32, 50));
            //pillar 2
            drawFrom(new Point(45, 38), new Point(45, 62));
            exclude(new Point(45, 50), new Point(45, 55));
            //key hole
            //key hole Left
            drawFrom(new Point(14, 45), new Point(14, 55));
            //horiztonal
            drawFrom(new Point(14, 45), new Point(20, 45));
            drawFrom(new Point(14, 55), new Point(20, 55));

            //top zone
            //entrance
            drawFrom(new Point(58, 12), new Point(63, 12));
            drawFrom(new Point(58, 5), new Point(73, 5));

            //vert right
            drawFrom(new Point(58, 2), new Point(58, 15));
            exclude(new Point(58, 6), new Point(58, 11));
            //horizontal
            drawFrom(new Point(24, 2), new Point(58, 2));
            drawFrom(new Point(24, 15), new Point(58, 15));
            //vert left
            drawFrom(new Point(24, 2), new Point(24, 15));
            exclude(new Point(24, 6), new Point(24, 11));

            //endzone
            //vert left
            drawFrom(new Point(18, 5), new Point(18, 12));
            //horizontal
            drawFrom(new Point(18, 5), new Point(24, 5));
            drawFrom(new Point(18, 12), new Point(24, 12));

            exit = new Exit(18, 6, 7, 6);

            //all of the keys
            //

            //GOLD KEY
            doors.Add(new Door(32, 45, true, 1, 6, true));//pillar left
            keys.Add(new Key(new PointF(75.50f, 25.5f), Stat.Gold, doors));

            //BLUE KEY
            doors.Add(new Door(45, 50, true, -1, 6, true));//pillar right
            keys.Add(new Key(new PointF(6.0f, 18.5f), Stat.Blue, doors));

            //GREEN KEY
            doors.Add(new Door(58, 6, true, -1, 3, true)); //top zone entrance
            keys.Add(new Key(new PointF(17.5f, 49.0f), Stat.Green, doors));
            doors.Add(new Door(58, 9, true, 1, 3, true));
            keys.Add(new Key(new PointF(17.5f, 49.0f), Stat.Green, doors));

            //RED KEY
            doors.Add(new Door(58, 45, true, -1, 5, true)); //bottom zone entrance
            keys.Add(new Key(new PointF(41.5f, 25.5f), Stat.Red, doors));
            doors.Add(new Door(58, 50, true, 1, 5, true));
            keys.Add(new Key(new PointF(41.5f, 25.5f), Stat.Red, doors));

            //all of the enemies
            //

            //enemies at bottom
            enemies.Add(new Enemy(new Point(38, 59), new Point(38, 41), 20, 0, 8));
            enemies.Add(new Enemy(new Point(51, 41), new Point(51, 59), 20, 0, 8));
            enemies.Add(new Enemy(new Point(26, 41), new Point(26, 59), 20, 0, 8));

            //enemies in middle
            enemyPoints.Add(new List<Point> { new Point(29, 21), new Point(54, 21), new Point(54, 31), new Point(29, 31) });
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 20, 6, 16));
            enemyPoints.Add(new List<Point> { new Point(54, 31), new Point(29, 31), new Point(29, 21), new Point(54, 21) });
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 20, 6, 16));

            //enemy in first corridor
            enemyPoints.Add(new List<Point> { new Point(6, 42), new Point(6, 26), new Point(16, 26), new Point(6, 26) });
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 20, 6, 16));

            //enemy in far right corridor
            enemies.Add(new Enemy(new Point(68, 51), new Point(68, 7), 20, 6, 8));

            //enemy in top
            enemyPoints.Add(new List<Point> { new Point(55, 4), new Point(26, 4), new Point(26, 11), new Point(55, 11) });
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 20, 6, 16));
        }
Ejemplo n.º 8
0
        //LEVEL 3 ***
        public void Level_3()
        {
            timeLimit = 35; //beat this level in 14 seconds (but that's Dylan
            time = timeLimit;

            //Initialize player *
            player = new Player(playerColor, new Point(39 * Stat.TileSize, 60 * Stat.TileSize));

            #region tiles
            //starting stuff
            drawFrom(new Point(36, 57), new Point(36, 62)); //west side
            drawFrom(new Point(44, 57), new Point(44, 62)); //east side
            drawFrom(new Point(36, 63), new Point(44, 63)); //south side
            //first zone
            drawFrom(new Point(2, 57), new Point(70, 57));//bottom
            exclude(new Point(37, 57), new Point(43, 57)); //zone entrance
            drawFrom(new Point(2, 47), new Point(70, 47));//top
            drawFrom(new Point(2, 47), new Point(2, 57)); //left
            drawFrom(new Point(70, 47), new Point(70, 57)); //right
            exclude(new Point(44, 47), new Point(50, 47));//green door
            exclude(new Point(22, 47), new Point(28, 47));//yellow door
            //keyhole
            drawFrom(new Point(48, 62), new Point(53, 62));
            drawFrom(new Point(48, 57), new Point(48, 62));
            drawFrom(new Point(53, 57), new Point(53, 62));
            exclude(new Point(49, 57), new Point(52, 57));
            //second zone
            drawFrom(new Point(44, 42), new Point(44, 47)); //green door entrance
            drawFrom(new Point(51, 42), new Point(51, 47)); //
            drawFrom(new Point(21, 42), new Point(21, 47)); //yellow door entrance
            drawFrom(new Point(28, 42), new Point(28, 47)); //
            drawFrom(new Point(10, 42), new Point(70, 42)); //bottom
            exclude(new Point(45, 42), new Point(50, 42)); //greendoor blank
            exclude(new Point(22, 42), new Point(27, 42)); //yellowdoor blank
            drawFrom(new Point(10, 28), new Point(10, 42)); //left
            drawFrom(new Point(70, 28), new Point(70, 42)); //right
            drawFrom(new Point(10, 28), new Point(70, 28)); //top
            exclude(new Point(45, 28), new Point(50, 28)); //exit
                //middle divide
            drawFrom(new Point(40, 28), new Point(40, 42));
            exclude(new Point(40, 32), new Point(40, 38));
            doors.Add(new Door(40, 32, true, -1, 3, false));
            doors.Add(new Door(40, 35, true, 1, 4, false));
            //third zone
            drawFrom(new Point(44, 13), new Point(44, 28));//left
            drawFrom(new Point(51, 13), new Point(51, 28));//right
            drawFrom(new Point(44, 13), new Point(51, 13));//top
            exclude(new Point(44, 16), new Point(44, 21)); //left entrance
            exclude(new Point(51, 16), new Point(51, 21)); //right entrance
            doors.Add(new Door(45, 28, false, -1, 3, false));
            doors.Add(new Door(48, 28, false, 1, 3, false));
                //left side of third zone
            drawFrom(new Point(39, 15), new Point(43, 15)); //top entrance
            drawFrom(new Point(39, 22), new Point(43, 22)); //bottom entrance
            drawFrom(new Point(39, 11), new Point(39, 26)); //entrance
            exclude(new Point(39, 16), new Point(39, 21)); //
            drawFrom(new Point(17, 11), new Point(39, 11)); //top
            drawFrom(new Point(17, 26), new Point(39, 26)); //bottom
            drawFrom(new Point(17, 11), new Point(17, 26)); //exit
            exclude(new Point(17, 16), new Point(17, 21));//
                //right side of third zone
            drawFrom(new Point(51, 15), new Point(75, 15)); //top
            drawFrom(new Point(51, 22), new Point(75, 22)); //bottom
            drawFrom(new Point(75, 15), new Point(75, 22)); //right right
            exclude(new Point(64,15), new Point(69,15)); // entrance
            drawFrom(new Point(63, 8), new Point(63, 15)); //left
            drawFrom(new Point(70, 2), new Point(70, 15)); //left
                    //long horizontal strip
            drawFrom(new Point(7, 2), new Point(70, 2)); //top
            drawFrom(new Point(13, 8), new Point(63, 8)); //bottom
                    //near endzone
            drawFrom(new Point(7, 2), new Point(7, 22));
            drawFrom(new Point(13, 8), new Point(13, 15));
            drawFrom(new Point(13, 15), new Point(17, 15));
            drawFrom(new Point(7, 22), new Point(17, 22));
            doors.Add(new Door(8, 15, false, 1, 5, false));
            doors.Add(new Door(8, 8, false, 1, 5, false));
            exit = new Exit(8, 9, 5, 6);
            #endregion
            //all keys and doors
            //
            #region doors and keys
            doors.Add(new Door(22, 47, false, -1, 3, true)); //gold door 1 (left
            keys.Add(new Key(new PointF(5.0f, 51f), Stat.Gold, doors));
            doors.Add(new Door(25, 47, false, 1, 3, true));
            keys.Add(new Key(new PointF(5.0f, 51f), Stat.Gold, doors));
            doors.Add(new Door(49, 57, false, -1, 2, true)); //gold door 2 (bottom
            keys.Add(new Key(new PointF(5.0f, 51f), Stat.Gold, doors));
            doors.Add(new Door(51, 57, false, 1, 2, true));
            keys.Add(new Key(new PointF(5.0f, 51f), Stat.Gold, doors));

            doors.Add(new Door(45, 47, false, -1, 3, true)); //green door
            keys.Add(new Key(new PointF(50.2f, 58.6f), Stat.Green, doors));
            doors.Add(new Door(48, 47, false, 1, 3, true));
            keys.Add(new Key(new PointF(50.2f, 58.6f), Stat.Green, doors));

            doors.Add(new Door(44, 16, true, -1, 3, true)); //red door left
            keys.Add(new Key(new PointF(67f, 34f), Stat.Red, doors));
            doors.Add(new Door(44, 19, true, 1, 3, true));
            keys.Add(new Key(new PointF(67f, 34f), Stat.Red, doors));

            doors.Add(new Door(51, 16, true, -1, 3, true)); //red door right
            keys.Add(new Key(new PointF(67f, 34f), Stat.Red, doors));
            doors.Add(new Door(51, 19, true, 1, 3, true));
            keys.Add(new Key(new PointF(67f, 34f), Stat.Red, doors));

            doors.Add(new Door(63, 3, true, 1, 5, true)); //blue door
            keys.Add(new Key(new PointF(72.5f, 17.5f), Stat.Blue, doors));
            #endregion

            //first zone
            enemyPoints.Add(new List<Point> { new Point(5, 53), new Point(65, 53), new Point(65, 50), new Point(5, 50) });
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 45, 0, 16));
            enemyPoints.Add(new List<Point> {new Point(65, 50), new Point(5, 50), new Point(5, 53), new Point(65, 53)});
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 45, 0, 16));
            //second zone left
            enemyPoints.Add(new List<Point> { new Point(12, 38), new Point(37, 38), new Point(37, 31), new Point(12, 31)});
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 25, 4, 12));
            enemyPoints.Add(new List<Point> { new Point(37, 31), new Point(12, 31), new Point(12, 38), new Point(37, 38), });
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 25, 4, 12));
            //second zone right
            enemyPoints.Add(new List<Point> { new Point(43, 38), new Point(66, 38), new Point(66, 31), new Point(43, 31) });
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 35, 4, 10));
            //third zone
            enemyPoints.Add(new List<Point> { new Point(18, 22), new Point(37, 22), new Point(37, 14), new Point(18, 14) });
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 30, 6, 7));
            enemyPoints.Add(new List<Point> { new Point(37, 14), new Point(18, 14), new Point(18, 22), new Point(37, 22) });
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 30, 6, 7));
        }
Ejemplo n.º 9
0
        //LEVEL 2 **
        public void Level_2()
        {
            timeLimit = (int)(50 / Stat.difficulty);
            time = timeLimit;

            //Initialize player *
            player = new Player(playerColor, new Point(4 * Stat.TileSize, 12 * Stat.TileSize));

            //around entrance
            drawFrom(new Point(1, 5), new Point(8, 5));  //top part
            drawFrom(new Point(1, 15), new Point(8, 15)); //bottom
            drawFrom(new Point(1, 5), new Point(1, 15));  //left part
            drawFrom(new Point(8, 5), new Point(8, 15));  //right part
            exclude(new Point(8, 5), new Point(8, 10));  //hole in right

            //exit room
            drawFrom(new Point(11, 20), new Point(19, 20));  //top part
            drawFrom(new Point(11, 10), new Point(11, 20));  //top part
            drawFrom(new Point(19, 10), new Point(19, 20)); //left part
            doors.Add(new Door(12, 10, false, -1, 7, true));
            keys.Add(new Key(new PointF(45.5f, 57f), Stat.Gold, doors));  //Gold key

            exit = new Exit(12, 13, 7, 7);

            //transition hall
            drawFrom(new Point(8, 5), new Point(50, 5)); //top
            drawFrom(new Point(8, 10), new Point(50, 10)); //bottom
            drawFrom(new Point(50, 5), new Point(50, 52)); //right line
            exclude(new Point(50, 22), new Point(50, 28));
            exclude(new Point(22, 10), new Point(49, 10));

            //main room
            drawFrom(new Point(22, 10), new Point(22, 48)); // left
            drawFrom(new Point(22, 48), new Point(50, 48));//bottom
            exclude(new Point(22, 36), new Point(22, 44));
            exclude(new Point(42, 48), new Point(49, 48));

            enemyPoints.Add(new List<Point> { new Point(26, 9), new Point(26, 42), new Point(45, 42), new Point(45, 9) });
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 30, 6, 16));

            enemyPoints.Add(new List<Point> { new Point(45, 42), new Point(45, 9), new Point(26, 9), new Point(26, 42) });
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 30, 6, 16));

            //left room
            drawFrom(new Point(12, 36), new Point(22, 36)); //top
            drawFrom(new Point(12, 44), new Point(22, 44)); // bottom
            drawFrom(new Point(12, 36), new Point(12, 44)); //left
            doors.Add(new Door(22, 37, true, -1, 7, true));
            keys.Add(new Key(new PointF(54f, 24.5f), Stat.Red, doors));  //Red key

            //right room
            drawFrom(new Point(62, 12), new Point(78, 12));  //room
            drawFrom(new Point(62, 34), new Point(78, 34));
            drawFrom(new Point(62, 12), new Point(62, 34));
            drawFrom(new Point(78, 12), new Point(78, 34));

            drawFrom(new Point(50, 22), new Point(62, 22)); //corridor
            drawFrom(new Point(50, 29), new Point(62, 29));

            doors.Add(new Door(62, 23, true, -1, 6, true));
            keys.Add(new Key(new PointF(17f, 39f), Stat.Blue, doors));  //Blue key

            enemies.Add(new Enemy(new Point(29, 25), new Point(45, 25), 20, 6, 8));

            enemyPoints.Add(new List<Point> { new Point(65, 30), new Point(74, 30), new Point(74, 15), new Point(65, 15) });

            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 15, 6, 16));

            //bottom room
            drawFrom(new Point(42, 48), new Point(42, 52));  //entrance
            drawFrom(new Point(35, 52), new Point(56, 52));  //top
            drawFrom(new Point(35, 62), new Point(56, 62));  //bottom
            drawFrom(new Point(35, 52), new Point(35, 62));
            drawFrom(new Point(56, 52), new Point(56, 62));
            exclude(new Point(43, 52), new Point(49, 52));
            doors.Add(new Door(43, 52, false, -1, 7, true));
            keys.Add(new Key(new PointF(70f, 14f), Stat.Green, doors));  //Green key

            exclude(new Point(12, 10), new Point(18, 10));
            exclude(new Point(62, 23), new Point(62, 28)); //opening
        }
Ejemplo n.º 10
0
        //LEVEL 1 *
        public void Level_1()
        {
            timeLimit = (int)(30 / Stat.difficulty);
            time = timeLimit;

            //Initialize player *
            player = new Player(playerColor, new Point(16 * Stat.TileSize, 42 * Stat.TileSize));

            //Level generation (walls/doors/keys/enemies) **
            //starting zone
            drawFrom(new Point(13, 45), new Point(21, 45)); //bottom part
            drawFrom(new Point(13, 38), new Point(13, 45)); //left part
            drawFrom(new Point(21, 38), new Point(21, 45)); //right part
            doors.Add(new Door(14, 37, false, -1, 7, false));

            //outside square
            drawFrom(new Point(3, 37), new Point(31, 37));  //bottom part
            exclude(new Point(14, 37), new Point(20, 37));
            drawFrom(new Point(3, 9), new Point(31, 9));  //top part
            exclude(new Point(14, 9), new Point(20, 9));
            doors.Add(new Door(14, 9, false, -1, 7, false));
            drawFrom(new Point(3, 9), new Point(3, 37));  //left part
            drawFrom(new Point(31, 9), new Point(31, 48));  //right part    (also acts as additional part)

            enemyPoints.Add(new List<Point> { new Point(8, 31), new Point(8, 14), new Point(25, 14), new Point(25, 31) });  //RUSH Enemy
            enemies.Add(new Enemy(enemyPoints[enemyPoints.Count - 1], 40, 6, 16));

            //inside square
            drawFrom(new Point(14, 20), new Point(14, 26)); //left part
            drawFrom(new Point(14, 20), new Point(20, 20)); //top part
            drawFrom(new Point(20, 20), new Point(20, 26)); //right part
            drawFrom(new Point(14, 26), new Point(20, 26)); //bottom part
            exclude(new Point(16, 26), new Point(18, 26)); //hole for key

            //transition hall and stealth part
            drawFrom(new Point(13, 2), new Point(13, 9));   //left wall
            drawFrom(new Point(13, 2), new Point(57, 2));   //top of hall
            drawFrom(new Point(57, 2), new Point(57, 37));   //right of wall
            enemies.Add(new Enemy(new Point(35, 12), new Point(35, 35), 20, 8, 0));
            enemies.Add(new Enemy(new Point(52, 35), new Point(52, 12), 20, 8, 0));
            drawFrom(new Point(41, 12), new Point(41, 38));   //inside left wall
            drawFrom(new Point(47, 12), new Point(47, 38));  //inside right wall

            //transition hall to last hallway
            drawFrom(new Point(57, 38), new Point(75, 38));   //top
            drawFrom(new Point(75, 38), new Point(75, 59));   //right
            //door between
            doors.Add(new Door(66, 48, false, -1, 9, true));
            keys.Add(new Key(new PointF(16.8f, 22f), Stat.Red, doors));  //red key

            //last hallway enemy
            enemies.Add(new Enemy(new Point(23, 53), new Point(59, 53), 19, 0, 14));  //bottom hall  |  back and forth

            //around exit

            drawFrom(new Point(9, 48), new Point(65, 48));  //top part  (also top of last hall)
            drawFrom(new Point(9, 59), new Point(75, 59));  //bottom part   (also bottom of last hall)
            drawFrom(new Point(9, 48), new Point(9, 59));  //left part

            exit = new Exit(9, 49, 10, 10);
        }
Ejemplo n.º 11
0
Archivo: Door.cs Proyecto: Jkoza/Vanish
        //OPENING ANIMATION
        public bool shouldSlide(Player player, Tile[,] grid)
        {
            bool noneBetween = true;   //referring to wall tiles in the way of door (don't want the door opening if there's a wall separating the door from the player)
            foreach (Tile t in grid)
            {
                if (vert)
                {
                    if (t.initialized &&
                        ((t.loc.X > player.xPos && t.loc.X < xPosClosed) ||     //Tile X in between Player and Door (horizontally)
                        (t.loc.X < player.xPos && t.loc.X > xPosClosed))
                        &&                                                  //AND
                         (t.loc.Y > yPosClosed && t.loc.Y < yPosClosed + size))     //Tile Y in between door top and bottom
                    {
                        noneBetween = false;
                    }
                }
                else if (!vert)
                {
                    if (t.initialized &&
                        ((t.loc.Y > player.yPos && t.loc.Y < yPosClosed) ||     //Tile Y in between Player and Door (horizontally)
                        (t.loc.Y < player.yPos && t.loc.Y > yPosClosed))
                        &&                                                  //AND
                         (t.loc.X > xPosClosed && t.loc.X < xPosClosed + size))     //Tile X in between door top and bottom
                    {
                        noneBetween = false;
                    }
                }
            }

                //if there are none inbetween then:

            if (player.xPos + doorProximity > xPosClosed && player.xPos - doorProximity < xPosClosed &&    //proximal to door
                player.yPos + doorProximity > yPosClosed && player.yPos - doorProximity < yPosClosed &&
                noneBetween)    //FIX Door not working
            {
                if (open == -1 && locked == false)   //unopened and unlocked
                {
                    return true;  //open
                }
            }
            else
            {
                if (open == 1)  //if open
                {
                    return true;  //close
                }
            }

            return false;
        }