Esempio n. 1
0
        public Room1(ImageHandler images)
        {
            sizeX = 1600;
            sizeY = 1000;

            boxList = new List<Box>(0);
            laserShooters = new List<LaserShooter>();
            laserCatchers = new List<LaserCatcher>();

            player = new Player(200, 100, 4);

            AddBoxesAround();

            screenX = Screen.X;
            screenY = Screen.Y;

            bluePortal = new Portal();
            orangePortal = new Portal();

            boxList.Add(new Box(300, 100, true, false));
            boxList.Add(new Box(300, 200, true, false));
            boxList.Add(new Box(300, 300, false, true));
            boxList.Add(new Box(300, 400, false, true));
            boxList.Add(new Box(300, 500, false, true));
            boxList.Add(new Box(300, 600, false, true));
            boxList.Add(new Box(300, 700, false, true));
            boxList.Add(new Box(300, 800, false, true));

            boxList.Add(new Box(100, 800, true, false));
            boxList.Add(new Box(200, 800, true, false));

            boxList.Add(new Box(600, 100, true, false));
            boxList.Add(new Box(600, 200, true, false));
            boxList.Add(new Box(600, 300, true, false));
            boxList.Add(new Box(600, 400, true, false));
            boxList.Add(new Box(600, 500, true, false));
            boxList.Add(new Box(600, 600, true, false));
            boxList.Add(new Box(600, 700, true, false));

            laserShooters.Add(new LaserShooter(100, 500, Math.PI / 2, images.laserSprites));
            //laserShooters.Add(new LaserShooter(100, 800, 0, images.laserSprites));

            player.sprite = images.playerSprite;
            player.blueBullet.sprite = images.blueBullet;
            player.orangeBullet.sprite = images.orangeBullet;

            background = images.background;
            screenSplitter = images.splitScreen;

            bluePortal.sprites = images.bluePortalSprites;
            orangePortal.sprites = images.orangePortalSprites;

            setBoxSprites(images.wall, images.portalWall, images.emptyBox);
            setAllLaserSprites(images.laserShooterSprites, images.laserCatcherSprites);
        }
Esempio n. 2
0
 /// <summary>
 /// Updates the logic for the sentry.
 /// </summary>
 /// <param name="player">The player in the current room.</param>
 /// <param name="boxList">The list of boxes in the current room.</param>
 public void Update(Player player, List<Box> boxList)
 {
 }
Esempio n. 3
0
        /// <summary>
        /// Checks the collision between the player and the portal, and keeps the player from 
        /// moving through the rest of the box.
        /// </summary>
        /// <param name="player">The Player in the game.</param>
        /// <param name="playerRoomX">The x-position of the player in the room.</param>
        /// <param name="playerRoomY">The y-position of the player in the room.</param>
        /// <param name="ported">The flag that says if there is a collision between the portal 
        /// and the player.</param>
        /// <param name="up">The direction that the player can go.</param>
        /// <param name="down">The direction that the player can go.</param>
        /// <param name="left">The direction that the player can go.</param>
        /// <param name="right">The direction that the player can go.</param>
        public void Porting(Player player, ref int playerRoomX, ref int playerRoomY, ref bool ported, ref bool up, 
            ref bool down, ref bool left, ref bool right)
        {
            if (portalDirection == 0)
            {
                if (Collision.TestCoordinate(roomX + sprite.Bounds.Center.X, roomY + sprite.Height, player))
                {
                    ported = true;
                    playerRoomX = roomX + sprite.Bounds.Center.X - player.sprite.Bounds.Center.X;
                    up = true;
                    if (roomY + sprite.Height == playerRoomY + player.sprite.Width)
                    { up = false; }

                    right = false;
                    left = false;
                }
                else
                { ported = false; }
            }

            if (portalDirection == Math.PI)
            {
                if (Collision.TestCoordinate(roomX + sprite.Bounds.Center.X, roomY, player))
                {
                    ported = true;
                    playerRoomX = roomX + sprite.Bounds.Center.X - player.sprite.Bounds.Center.X;
                    down = true;
                    if (roomY == playerRoomY)
                    { down = false; }

                    right = false;
                    left = false;
                }
                else
                { ported = false; }
            }

            if (portalDirection == -Math.PI / 2)
            {
                if (Collision.TestCoordinate(roomX, roomY + sprite.Bounds.Center.Y, player))
                {
                    ported = true;
                    playerRoomY = roomY + sprite.Bounds.Center.Y - player.sprite.Bounds.Center.Y;
                    right = true;
                    if (roomX == playerRoomX)
                    { right = false; }

                    up = false;
                    down = false;
                }
                else
                { ported = false; }
            }

            if (portalDirection == Math.PI / 2)
            {
                if (Collision.TestCoordinate(roomX + sprite.Width, roomY + sprite.Bounds.Center.Y, player))
                {
                    ported = true;
                    playerRoomY = roomY + sprite.Bounds.Center.Y - player.sprite.Bounds.Center.Y;
                    left = true;
                    if (roomX + sprite.Width == playerRoomX + player.sprite.Width)
                    { left = false; }

                    up = false;
                    down = false;
                }
                else
                { ported = false; }
            }
        }