Beispiel #1
0
 public ChangeRoomState(string direction, IPlayer player, LegendOfZelda game)
 {
     this.direction = direction;
     if (direction == "left" || direction == "right")
     {
         this.timer = 257 / 2;
     }
     else if (direction == "up" || direction == "down")
     {
         this.timer = 177 / 2;
     }
     else
     {
         this.timer = 60;
     }
     this.game   = game;
     this.player = player;
     player.Inventory.BlueCandle.UsedInRoom = false;
     if (player.Inventory.HasClock)
     {
         this.player = (player as DamagedLink).InnerLink;
         game.rooms[game.roomIndex].Players[player.ID] = this.player;
         this.player.Inventory.HasClock           = false;
         game.rooms[game.roomIndex].FreezeEnemies = false;
     }
     game.rooms[game.roomIndex].Players.Remove(player.ID);
     game.ProjectileManager.Clear();
 }
 public PlayState(LegendOfZelda game)
 {
     this.HUD           = Textures.GetHUD();
     this.HUDBackground = Textures.GetHUDBackground();
     this.game          = game;
     game.music.Play();
 }
 public HUDHearts(LegendOfZelda game)
 {
     this.game          = game;
     numFullHearts      = 0;
     numHalfHearts      = 0;
     numEmptyHearts     = 0;
     sheetX             = 0;
     sheetY             = 0;
     finalX             = 476;
     initX              = 372;
     initY              = 80;
     currentX           = 372;
     currentY           = 80;
     currentInt         = 0;
     fullX              = 0;
     fullY              = 34;
     halfX              = 8;
     halfY              = 0;
     emptyX             = 16;
     emptyY             = 0;
     rowDiff            = 13;
     columnDiff         = 12;
     suddenDeathOffset  = 20;
     suddenDeathMessage = FontSpriteFactory.GetSuddenDeathMessage();
 }
 public CollisionDetector(IProjectileManager projectileManager, LegendOfZelda game)
 {
     this.game              = game;
     collisions             = new List <ICollision>();
     this.projectileManager = projectileManager;
     this.game              = game;
 }
 public PauseState(LegendOfZelda game)
 {
     this.HUD           = Textures.GetHUD();
     this.HUDBackground = Textures.GetHUDBackground();
     this.game          = game;
     pausemessage       = new PauseMessage(this.game);
 }
Beispiel #6
0
 public PlayerNPCCollision(IPlayer player, INPC npc, String attackDirection, LegendOfZelda game)
 {
     this.player          = player;
     this.npc             = npc;
     this.attackDirection = attackDirection;
     this.game            = game;
 }
Beispiel #7
0
 protected void Initialize(LegendOfZelda game, int id)
 {
     this.ID             = id;
     this.game           = game;
     this.Direction      = "up";
     this.Sprite.Scale   = 2.0f;
     this.footbox        = new Rectangle(0, 0, Sprite.Box.Width, Sprite.Box.Height / 2);
     this.hitbox         = Sprite.Box;
     this.X              = 250;
     this.Y              = 295;
     this.attackBoxLeft  = new Rectangle(x - 25, y + Sprite.Box.Height / 4, 25, Sprite.Box.Height / 2);
     this.attackBoxRight = new Rectangle(x + Sprite.Box.Width, y + Sprite.Box.Height / 4, 25, Sprite.Box.Height / 2);
     this.attackBoxUp    = new Rectangle(x + Sprite.Box.Width / 4, y - 25, Sprite.Box.Width / 2, 25);
     this.attackBoxDown  = new Rectangle(x + Sprite.Box.Width / 4, y + Sprite.Box.Height, Sprite.Box.Width / 2, 25);
     this.itemTimer      = 0;
     if (game.currentMode.Equals("sudden death"))
     {
         this.MaxHearts     = 0.5;
         this.CurrentHearts = 0.5;
         HeartsCanChange    = false;
     }
     else
     {
         this.MaxHearts     = 3.0;
         this.CurrentHearts = 3.0;
         HeartsCanChange    = true;
     }
     this.Resistance  = 0;
     this.origin      = new Vector2(0, 0);
     this.Inventory   = new Inventory();
     this.HeldItem    = new Bomb();
     this.CurrentItem = new Boomerang();
     this.DeadColor   = Microsoft.Xna.Framework.Color.White;
 }
Beispiel #8
0
 public HUDMap(LegendOfZelda game)
 {
     this.game  = game;
     bigOffsetX = 140;
     bigOffsetY = 105;
     int[] locations =
     {
         68, 90,  //room0
         84, 90,  //room1
         101, 90, //room2
         84, 82,  //room3
         68, 73,  //room4
         84, 73,  //room5
         101, 73, //room6
         52, 65,  //room7
         68, 65,  //room8
         84, 65,  //9
         101, 65, //10
         118, 65, //11
         84, 57,  //12
         118, 57, //13
         135, 57, //14
         68, 49,  //15
         0, 0,    // place holder for room 16
         84, 59
     };           //17
     compassBox.X        = locations[28];
     compassBox.Y        = locations[29] + offset;
     bigCompassBox.X     = locations[28] * 2 + bigOffsetX;
     bigCompassBox.Y     = locations[29] * 2 + bigOffsetY;
     bigCompassBox.Scale = 3;
     this.locations      = locations;
     currentDelay        = 0;
     totalDelay          = 5;
 }
        public void HandleEdge(IPlayer player, IDoor door, LegendOfZelda game, int margin = 8)
        {
            cmdRight  = new SwapRoomCommand(game, player, "next");
            cmdLeft   = new SwapRoomCommand(game, player, "previous");
            cmdUp     = new SwapRoomCommand(game, player, "up");
            cmdDown   = new SwapRoomCommand(game, player, "down");
            cmdPortal = new PortalRoomCommand(game, game.Link);

            //change rooms based on door collision
            if ((door is TopOpen || door is TopExploded) && player.Hitbox.Top - door.Hitbox.Top < margin)
            {
                cmdUp.Execute();
                player.Y = 400;
            }
            if ((door is BottomOpen || door is BottomExploded) && door.Hitbox.Bottom - player.Hitbox.Bottom < margin)
            {
                cmdDown.Execute();
                player.Y = 180;
            }
            if ((door is LeftOpen || door is LeftExploded) && player.Hitbox.Left - door.Hitbox.Left < margin)
            {
                cmdLeft.Execute();
                player.X = 417;
            }
            if ((door is RightOpen || door is RightExploded) && door.Hitbox.Right - player.Hitbox.Right < margin)
            {
                cmdRight.Execute();
                player.X = 60;
            }
            if (door is LeftPortal && player.Hitbox.Left - door.Hitbox.Left < margin)
            {
                cmdPortal.Execute();
            }
        }
        public static IList <IRoom> GeneratePuzzleRoomList(LegendOfZelda game)
        {
            IList <IRoom> list = new List <IRoom>()
            {
                new Room(game, "Rooms/RoomP0.csv"),
                new Room(game, "Rooms/RoomP1.csv"),
                new Room(game, "Rooms/RoomP2.csv"),
                new Room(game, "Rooms/RoomP3.csv"),
                new Room(game, "Rooms/RoomP4.csv"),
                new Room(game, "Rooms/RoomP5.csv"),
                new Room(game, "Rooms/RoomP6.csv"),
                new Room(game, "Rooms/RoomP7.csv"),
                new Room(game, "Rooms/RoomP8.csv"),
                new Room(game, "Rooms/RoomP9.csv"),
                new Room(game, "Rooms/RoomP10.csv"),
                new Room(game, "Rooms/RoomP11.csv"),
                new Room(game, "Rooms/RoomP12.csv"),
                new Room(game, "Rooms/RoomP13.csv"),
                new Room(game, "Rooms/RoomP14.csv"),
                new Room(game, "Rooms/RoomP15.csv"),
                new Room(game, "Rooms/RoomP16.csv"),
            };

            return(list);
        }
        public static IList <IRoom> GenerateRoomList(LegendOfZelda game)
        {
            IList <IRoom> list = new List <IRoom>()
            {
                new Room(game, "Rooms/Room0.csv"),
                new Room(game, "Rooms/Room1.csv"),
                new Room(game, "Rooms/Room2.csv"),
                new Room(game, "Rooms/Room3.csv"),
                new Room(game, "Rooms/Room4.csv"),
                new Room(game, "Rooms/Room5.csv"),
                new Room(game, "Rooms/Room6.csv"),
                new Room(game, "Rooms/Room7.csv"),
                new Room(game, "Rooms/Room8.csv"),
                new Room(game, "Rooms/Room9.csv"),
                new Room(game, "Rooms/Room10.csv"),
                new Room(game, "Rooms/Room11.csv"),
                new Room(game, "Rooms/Room12.csv"),
                new Room(game, "Rooms/Room13.csv"),
                new Room(game, "Rooms/Room14.csv"),
                new Room(game, "Rooms/Room15.csv"),
                new Room(game, "Rooms/Room16.csv"),
                new Room(game, "Rooms/Room17.csv"),
            };

            return(list);
        }
 public LoseState(LegendOfZelda game)
 {
     this.game = game;
     game.music.Pause();
     this.tint          = Color.White;
     this.tintTimer     = 0;
     this.HUDBackground = Textures.GetHUDBackground();
 }
 public ISprite CreateRoom9(LegendOfZelda game)
 {
     if (game.currentMode.Equals("puzzle"))
     {
         return(new Sprite(roomSheet, new Rectangle(772, 532, 256, 176)));
     }
     return(new Sprite(roomSheet, new Rectangle(515, 355, 256, 176)));
 }
 public InventoryState(LegendOfZelda game)
 {
     this.HUD           = Textures.GetHUD();
     this.HUDBackground = Textures.GetHUDBackground();
     this.Inventory     = Textures.GetInventory();
     this.game          = game;
     this.invent        = new Invent(game);
 }
Beispiel #15
0
 public PlayerBlockCollision(IDictionary <string, IDoor> doors, IPlayer player,
                             IBlock block, LegendOfZelda game)
 {
     this.game   = game;
     this.doors  = doors;
     this.player = player;
     this.block  = block;
 }
 public ISprite CreateRoom3(LegendOfZelda game)
 {
     if (game.currentMode.Equals("puzzle"))
     {
         return(new Sprite(roomSheet, new Rectangle(1286, 886, 256, 176)));
     }
     return(new Sprite(roomSheet, new Rectangle(515, 709, 256, 176)));
 }
 public PlayerDoorCollision(IDictionary <string, IDoor> doors,
                            KeyValuePair <string, IDoor> door, IPlayer player, LegendOfZelda game)
 {
     this.game   = game;
     this.player = player;
     this.doors  = doors;
     this.door   = door;
 }
 public ISprite CreateRoom16(LegendOfZelda game)
 {
     if (game.currentMode.Equals("puzzle"))
     {
         return(new Sprite(roomSheet, new Rectangle(1286, 355, 256, 176)));
     }
     return(new Sprite(roomSheet, new Rectangle(258, 1, 256, 176)));
 }
Beispiel #19
0
 public StoryState(LegendOfZelda game)
 {
     this.game = game;
     game.GraphicsDevice.Clear(Color.Black);
     this.story = MiscSpriteFactory.Instance.CreateStory();
     story.Y    = game.GraphicsDevice.Viewport.Height;
     clickDelay = 15;
 }
 public ModeSelector(LegendOfZelda game)
 {
     this.game           = game;
     this.selectorSprite = MiscSpriteFactory.Instance.CreateModeSelector();
     currentDelay        = 0;
     totalDelay          = 5;
     selectorSprite.X    = x;
     selectorSprite.Y    = normalY;
 }
 public TransitionToInventoryState(LegendOfZelda game)
 {
     this.game          = game;
     updateTimer        = 1;
     pos                = 0;
     this.HUD           = Textures.GetHUD();
     this.HUDBackground = Textures.GetHUDBackground();
     this.Inventory     = Textures.GetInventory();
 }
Beispiel #22
0
 public SelectGameState(LegendOfZelda game)
 {
     this.game         = game;
     this.selectScreen = FontSpriteFactory.GetModeScreen();
     selectScreen.X    = 40;
     selectScreen.Y    = 40;
     this.screen       = Textures.GetBlankTexture();
     selector          = new ModeSelector(this.game);
     game.keyboard     = GameSetup.CreateMenuKeysController(game);
 }
Beispiel #23
0
        public StartMenuState(LegendOfZelda game)
        {
            MediaPlayer.Play(Sounds.GetMenuSong());

            this.game     = game;
            StartMenu     = Textures.GetStartMenu();
            game.keyboard = GameSetup.CreateSimpleKeysController(game);
            counter       = 0;
            delay         = 13;
        }
Beispiel #24
0
 public OldMan(LegendOfZelda game)
 {
     sprite          = EnemySpriteFactory.Instance.CreateOldManSprite();
     X               = 240;
     Y               = 250;
     sprite.Position = new Point(X, Y);
     Hitbox          = sprite.Box;
     this.game       = game;
     attackTimer     = 50;
 }
Beispiel #25
0
 public TransitionFromInventoryState(LegendOfZelda game)
 {
     this.game          = game;
     updateTimer        = 1;
     pos                = 0;
     CurtainHeight      = game.GraphicsDevice.Viewport.Height;
     this.HUD           = Textures.GetHUD();
     this.HUDBackground = Textures.GetHUDBackground();
     this.Inventory     = Textures.GetInventory();
     game.hud.offset    = 0;
 }
Beispiel #26
0
 public Fire(LegendOfZelda loz, IDictionary <int, IPlayer> players)
 {
     game            = loz;
     this.players    = players;
     Sprite          = EnemySpriteFactory.Instance.CreateFireSprite();
     Hitbox          = Sprite.Box;
     Sprite.Position = new Point(X, Y);
     State           = new EnemyState(this);
     timer           = 0;
     currentHearts   = 100;
 }
        public ItemShopSelector(LegendOfZelda game)
        {
            string[] items = { "sword", "heart", "bluepotion" };
            this.game = game;

            this.selectorSprite = MiscSpriteFactory.Instance.CreateItemShopSelector();
            hudrupees           = new HUDCounter(this.game, "rupees");
            currentDelay        = 0;
            totalDelay          = 5;
            selectorSprite.X    = x;
            selectorSprite.Y    = normalY;
        }
        public static IController CreateSimpleKeysController(LegendOfZelda game)
        {
            IDictionary <Keys, ICommand> keyBinds = new Dictionary <Keys, ICommand>();
            ICommand cmd;

            cmd = new ResetCommand(game);
            keyBinds.Add(Keys.R, cmd);

            cmd = new QuitCommand(game);
            keyBinds.Add(Keys.Q, cmd);

            return(new SinglePressKeyboardController(keyBinds));
        }
Beispiel #29
0
        public ItemShopState(LegendOfZelda game)
        {
            this.game              = game;
            this.itemShopScreen    = FontSpriteFactory.GetItemShopScreen();
            this.zeroBalanceSprite = MiscSpriteFactory.Instance.CreateZeroBalanceSprite();

            zeroBalanceSprite.X = 0;
            zeroBalanceSprite.Y = 370;
            this.screen         = Textures.GetBlankTexture();
            selector            = new ItemShopSelector(this.game);

            displayError = false;
        }
Beispiel #30
0
 public WinState(LegendOfZelda game)
 {
     this.game          = game;
     bw                 = false;
     timer              = 0;
     RightCurtain       = Textures.GetWinCurtain();
     LeftCurtain        = Textures.GetWinCurtain();
     rightPos           = -game.GraphicsDevice.Viewport.Width / 2 - 20;
     leftPos            = game.GraphicsDevice.Viewport.Width;
     CurtainWidth       = game.GraphicsDevice.Viewport.Width / 2 + 20;
     CurtainHeight      = game.GraphicsDevice.Viewport.Height;
     finalDelay         = 0;
     this.HUD           = Textures.GetHUD();
     this.HUDBackground = Textures.GetHUDBackground();
 }