Example #1
0
        private void LoadRoom(Vector2 position, GameData data)
        {
            //floor
            EntList.Add(new BldgFloor(position, new Vector2(houseWidth, houseHeight)));

            //solid walls
            EntList.Add(new BldgWall(position + new Vector2(0, halfHeight + wallHalfWidth), new Vector2(houseWidth + 2 * wallWidth, wallWidth), 0));
            EntList.Add(new BldgWall(position - new Vector2(0, halfHeight + wallHalfWidth), new Vector2(houseWidth + 2 * wallWidth, wallWidth), 0));
            EntList.Add(new BldgWall(position - new Vector2(halfWidth + wallHalfWidth, 0), new Vector2(houseHeight, wallWidth), 3 * MathHelper.PiOver2));
            EntList.Add(new BldgWall(position + new Vector2(halfWidth + wallHalfWidth, 0), new Vector2(houseHeight, wallWidth), MathHelper.PiOver2));

            //switch
            if (!data.SwitchFound)
            {
                Switch s = new Switch(position + new Vector2(halfWidth - 32, halfHeight - 32));
                EntList.Add(s);
                PickupTriggers.Add(new TriggerPickup(s.Position, new Vector2(64, 64), s));
            }

            Note n = new Note(Vector2.Zero);
            EntList.Add(n);
            ReadingTriggers.Add(new TriggerReading(n.Position, new Vector2(64, 64), Notes.HouseNote));

            //stairs
            Stairs st = new Stairs(position - (new Vector2(halfWidth - stairsHalfWidth - 80, -halfHeight + stairsHalfHeight)));
            EntList.Add(st);
            EntList.Add(new Border(st.Position - new Vector2(0, st.Size.Y / 2 + 2), new Vector2(st.Size.X, 4)));
            EntList.Add(new Border(st.Position + new Vector2(st.Size.X / 2 + 2, 1), new Vector2(4, st.Size.Y + 2)));
            AreaChangeTriggers.Add(new TriggerChangeArea(st.Position, st.Size - new Vector2(10, 10), new AreaMars()));
        }
Example #2
0
 public WorldState(Area area)
 {
     c = new Camera();
     c.UnitScale = 1;
     this.area = area;
     message = String.Empty;
     data = new GameData();
 }
Example #3
0
        public void GenerateHouse1(Vector2 position, GameData data)
        {
            const float doorSize = 96;
            const float doorAscent = 96;
            const float houseWidth = 512;
            const float houseHeight = 384;
            const float halfWidth = houseWidth / 2;
            const float halfHeight = houseHeight / 2;
            const float wallWidth = 16;
            const float wallHalfWidth = wallWidth / 2;

            const float doorTopHeight = doorSize + doorAscent;
            const float wallAboveDoorSize = (houseHeight - (doorAscent + doorSize));
            const float halfWallAboveDoorSize = wallAboveDoorSize / 2;

            const float stairsWidth = 96;
            const float stairsHeight = 64;

            const float stairsHalfWidth = stairsWidth / 2;
            const float stairsHalfHeight = stairsHeight / 2;

            //floor
            EntList.Add(new BldgFloor(position, new Vector2(houseWidth, houseHeight)));

            //solid walls
            EntList.Add(new BldgWall(position + new Vector2(0, halfHeight + wallHalfWidth), new Vector2(houseWidth + 2 * wallWidth, wallWidth), 0));
            EntList.Add(new BldgWall(position - new Vector2(0, halfHeight + wallHalfWidth), new Vector2(houseWidth + 2 * wallWidth, wallWidth), 0));
            EntList.Add(new BldgWall(position - new Vector2(halfWidth + wallHalfWidth, 0), new Vector2(houseHeight, wallWidth), 3 * MathHelper.PiOver2));

            //wall w/ entrance
            EntList.Add(new BldgWall(position - new Vector2(-halfWidth - wallHalfWidth, halfHeight - (doorAscent / 2)), new Vector2(doorAscent, wallWidth), MathHelper.PiOver2));
            EntList.Add(new BldgWall(position - new Vector2(-halfWidth - wallHalfWidth, halfHeight - doorTopHeight - halfWallAboveDoorSize), new Vector2(wallAboveDoorSize, wallWidth), MathHelper.PiOver2));

            //stairs
            Stairs s = new Stairs(position - new Vector2(halfWidth - stairsHalfWidth, -halfHeight + stairsHalfHeight));
            EntList.Add(s);
            EntList.Add(new Border(s.Position - new Vector2(0, s.Size.Y / 2 + 2), new Vector2(s.Size.X, 4)));
            AreaChangeTriggers.Add(new TriggerChangeArea(s.Position, s.Size - new Vector2(10, 10), new AreaUpstairs()));
        }
Example #4
0
        public override void LoadContent(GameData data)
        {
            EntList.Add(new SpaceshipInt(Vector2.Zero));
            Note n = new Note(new Vector2(-64, 40));
            EntList.Add(n);
            ReadingTriggers.Add(new TriggerReading(n.Position, new Vector2(64, 64), Notes.ShipNote));

            AreaChangeTriggers.Add(new TriggerChangeArea(new Vector2(0, 80), new Vector2(96, 48), new AreaMars()));

            EntList.Add(new Border(new Vector2(-128 - 16, 0), new Vector2(32, 256)));
            EntList.Add(new Border(new Vector2(128 + 16, 0), new Vector2(32, 256)));
            EntList.Add(new Border(new Vector2(0, -128 - 16), new Vector2(256, 32)));
            EntList.Add(new Border(new Vector2(0, 128 + 16), new Vector2(256, 32)));

            EntList.Add(new Border(new Vector2(-1, -96), new Vector2(88, 30)));

            if (data.CoreFound && data.FuseFound && data.SwitchFound)
            {
                EndgameTrigger.Add(new TriggerEndgame(new Vector2(0, 40), new Vector2(100, 100)));
            }

            Resources.StopAllAudio();
            Resources.Audio["shipStaticLoop.wav"].Play();
        }
Example #5
0
        public void GeneratePrison(Vector2 position, GameData data)
        {
            const float doorSize = 96;
            const float doorAscent = 64;
            const float prisonWidth = 576;
            const float prisonHeight = 576;
            const float halfWidth = prisonWidth / 2;
            const float halfHeight = prisonHeight / 2;
            const float wallWidth = 16;
            const float wallHalfWidth = wallWidth / 2;

            const float doorTopHeight = doorSize + doorAscent;
            const float wallAboveDoorSize = (prisonHeight - (doorAscent + doorSize));
            const float halfWallAboveDoorSize = wallAboveDoorSize / 2;

            const float cellSize = prisonWidth / 3;
            const float cellDoorSize = 96;
            float internalWallHeight = position.Y + halfHeight - cellSize - wallHalfWidth;
            float internalWallSize = cellSize - cellDoorSize;

            //floor
            EntList.Add(new BldgFloor(position, new Vector2(prisonWidth, prisonHeight)));

            //solid walls
            EntList.Add(new BldgWall(position + new Vector2(0, halfHeight + wallHalfWidth), new Vector2(prisonWidth + 2 * wallWidth, wallWidth), 0));
            EntList.Add(new BldgWall(position - new Vector2(0, halfHeight + wallHalfWidth), new Vector2(prisonWidth + 2 * wallWidth, wallWidth), 0));
            EntList.Add(new BldgWall(position + new Vector2(halfWidth + wallHalfWidth, 0), new Vector2(prisonHeight, wallWidth), 3 * MathHelper.PiOver2));

            //wall w/ entrance
            EntList.Add(new BldgWall(position - new Vector2(halfWidth + wallHalfWidth, halfHeight - (doorAscent / 2)), new Vector2(doorAscent, wallWidth), MathHelper.PiOver2));
            EntList.Add(new BldgWall(position - new Vector2(halfWidth + wallHalfWidth, halfHeight - doorTopHeight - halfWallAboveDoorSize), new Vector2(wallAboveDoorSize, wallWidth), MathHelper.PiOver2));

            //internal walls
            EntList.Add(new BldgWall(new Vector2(position.X - halfWidth + cellDoorSize + (internalWallSize / 2), internalWallHeight), new Vector2(cellSize - cellDoorSize, wallWidth), 0));
            EntList.Add(new BldgWall(new Vector2(position.X - halfWidth + cellSize + cellDoorSize + (internalWallSize / 2), internalWallHeight), new Vector2(cellSize - cellDoorSize, wallWidth), 0));
            EntList.Add(new BldgWall(new Vector2(position.X - halfWidth + 2 * cellSize + cellDoorSize + (internalWallSize / 2), internalWallHeight), new Vector2(cellSize - cellDoorSize, wallWidth), 0));
            EntList.Add(new BldgWall(new Vector2(position.X - halfWidth + cellSize - wallHalfWidth, internalWallHeight + (cellSize / 2) + wallHalfWidth), new Vector2(cellSize, wallWidth), 3 * MathHelper.PiOver2));
            EntList.Add(new BldgWall(new Vector2(position.X - halfWidth + 2 * cellSize - wallHalfWidth, internalWallHeight + (cellSize / 2) + wallHalfWidth), new Vector2(cellSize, wallWidth), 3 * MathHelper.PiOver2));

            //key
            if (!data.PrisonKeyFound)
            {
                DoorKey prisonKey = new DoorKey(position + new Vector2(halfWidth, -halfHeight) - new Vector2(32, -32), "prison door key");
                PickupTriggers.Add(new TriggerPickup(prisonKey.Position, new Vector2(64, 64), prisonKey));
                EntList.Add(prisonKey);
            }

            Note n = new Note(position - new Vector2(halfWidth, halfHeight) + new Vector2(64, 64));
            EntList.Add(n);
            ReadingTriggers.Add(new TriggerReading(n.Position, new Vector2(64, 64), Notes.PrisonNote));

            //doors
            Door prisonDoor = new Door(new Vector2(position.X - halfWidth + (cellDoorSize / 2), internalWallHeight), 0, "prison door");
            if (!data.PrisonDoorOpened)
            {
                EntList.Add(prisonDoor);
            }
            else
                prisonDoor.Unload();
            EntList.Add(new Door(new Vector2(position.X - halfWidth + cellSize + (cellDoorSize / 2), internalWallHeight), 0));
            EntList.Add(new Door(new Vector2(position.X - halfWidth + cellSize * 2 + (cellDoorSize / 2), internalWallHeight), 0));

            DoorOpenTriggers.Add(new TriggerDoorOpen(prisonDoor.Position, new Vector2(96, 96), prisonDoor, "prison door key"));

            //fuse
            if (!data.FuseFound)
            {
                Fuse f = new Fuse(new Vector2(position.X - halfWidth + (cellSize / 2), internalWallHeight + (cellSize / 2)));
                EntList.Add(f);
                PickupTriggers.Add(new TriggerPickup(f.Position, new Vector2(64, 64), f));
            }
        }
Example #6
0
        public override void LoadContent(GameData data)
        {
            Random random = new Random();
            for (int i = 0; i < 150; i++)
            {
                EntList.Add(new Pebble(new Vector2((float)(random.NextDouble() * 3000) - 1500, (float)(random.NextDouble() * 3000) - 1500), (random.Next(0, 2) == 1) ? Resources.Textures["pebble1.png"] : Resources.Textures["pebble2.png"]));
            }

            //EntList.Add(new Rock(new Vector2(-100, 50), Resources.Textures["rock1.png"]));

            GeneratePrison(new Vector2(512, 512), data);
            GenerateHouse1(new Vector2(-768, 256), data);

            EntList.Add(new CaveStairs(new Vector2(-128, 768)));
            EntList.Add(new SpaceshipExt(new Vector2(-64, -400)));
            AreaChangeTriggers.Add(new TriggerChangeArea(new Vector2(-64, -200), new Vector2(96, 64), new AreaShip()));
            AreaChangeTriggers.Add(new TriggerChangeArea(new Vector2(-128, 768), new Vector2(64, 96), new AreaCave()));

            Resources.StopAllAudio();
            Resources.Audio["wind.wav"].Play();
        }
Example #7
0
        public override void LoadContent(GameData data)
        {
            LoadRoom(Vector2.Zero, data);

            Resources.StopAllAudio();
        }