Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new LevelMenuState.
        /// </summary>
        public LevelMenuState()
            : base("levelMenu")
        {
            // Add the background
            TextureEntity background = new TextureEntity();
            background.Texture = GameHandler.AssetHandler.GetTexture("Backgrounds/spr_levelselect");
            background.ResizeToTexture();
            AddChild(background);
            ResizeToContents();

            // Add a back button
            BackButton backButton = new BackButton();
            backButton.Position = new Vector2((GameHandler.GraphicsHandler.Resolution.X - backButton.Size.X) / 2, 750);
            AddChild(backButton);

            // Load buttons
            int levels = ((PlayingState)GameHandler.StateHandler.States["playing"]).Levels.Count;
            for (int i = 0; i < levels; i++) {
                int row = i / 5;
                int column = i % 5;

                LevelButton button = new LevelButton(((PlayingState)GameHandler.StateHandler.States["playing"]).Levels[i]);
                button.Position = new Vector2(column * (button.Size.X + 20F), row * (button.Size.Y + 20F)) + new Vector2(390F, 180F);
                AddChild(button);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new HelpMenuState.
        /// </summary>
        public HelpMenuState()
            : base("helpMenu")
        {
            // Add the background
            TextureEntity background = new TextureEntity();
            background.Texture = GameHandler.AssetHandler.GetTexture("Backgrounds/spr_help");
            background.ResizeToTexture();
            AddChild(background);
            ResizeToContents();

            // Add a back button
            BackButton backButton = new BackButton();
            backButton.Position = new Vector2((Size.X - backButton.Size.X) / 2, 750);
            AddChild(backButton);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new TitleMenuState.
        /// </summary>
        public TitleMenuState()
            : base("titleMenu")
        {
            // Add the background
            TextureEntity background = new TextureEntity();
            background.Texture = GameHandler.AssetHandler.GetTexture("Backgrounds/spr_title");
            background.ResizeToTexture();
            AddChild(background);
            ResizeToContents();

            // Add a play button
            PlayButton playButton = new PlayButton();
            playButton.Position = new Vector2((Size.X - playButton.Size.X) / 2, 540);
            AddChild(playButton);

            // Add a help button
            HelpButton helpButton = new HelpButton();
            helpButton.Position = new Vector2((Size.X - helpButton.Size.X) / 2, 600);
            AddChild(helpButton);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates a new PlayingState.
        /// </summary>
        public PlayingState()
            : base("playing")
        {
            TextureEntity background = new TextureEntity();
            background.Texture = GameHandler.AssetHandler.GetTexture("Backgrounds/spr_sky");
            AddChild(background);
            Size = new Vector2(GameHandler.GraphicsHandler.Resolution.X, GameHandler.GraphicsHandler.Resolution.Y);
            background.Size = Size;

            // Load levels
            for (int i = 1; i <= GameHandler.AssetHandler.CountFiles("Levels") - 1; i++) {
                LevelEntity level = new LevelEntity(i);
                level.Active = false;
                level.Visible = false;
                AddChild(level);
            }

            // Add quit button
            QuitButton quitButton = new QuitButton();
            quitButton.Position = new Vector2(Size.X - quitButton.Size.X - 10, 10);
            AddChild(quitButton);

            // Game over
            _Overlay = new TextureEntity();
            _Overlay.Visible = false;
            AddChild(_Overlay);

            // Show timer
            Timer = new TimerEntity();
            Timer.Position = new Vector2(25, 30);
            AddChild(Timer);

            // Show hint
            Hint = new HintEntity();
            Hint.Position = new Vector2((Size.X - Hint.Size.X) / 2, 10);
            AddChild(Hint);
        }