Example #1
0
        public Pause(NeonArkanoidGame game, Level.Level level)
        {
            _level = level;
            _game  = game;

            x = -500;

            var background = new Sprite(UtilStrings.SpritesPause + "background_pause.png");

            background.SetOrigin(0, background.height / 2);
            background.y = game.height / 2;

            var header = new Sprite(UtilStrings.SpritesPause + "header_pause.png");

            header.SetOrigin(header.width / 2, header.height / 2);
            header.SetXY(background.width / 2, 200);

            _buttons = new[]
            {
                new Button(UtilStrings.SpritesPause + "button_resume.png", 2, background.width / 2, 350, "Resume"),
                new Button(UtilStrings.SpritesPause + "button_restart.png", 2, background.width / 2, 450,
                           _level.GetLevelName()),
                new Button(UtilStrings.SpritesPause + "button_exit.png", 2, background.width / 2, 550, "MainMenu")
            };

            AddChild(background);
            AddChild(header);
            foreach (var button in _buttons)
            {
                AddChild(button);
            }

            _selectedSound = new Sound(UtilStrings.SoundsMenu + "sound_selected.wav");
            _openSound     = new Sound(UtilStrings.SoundsMenu + "sound_pause.wav");
        }
Example #2
0
        public Pause(NeonArkanoidGame game, Level.Level level)
        {
            _level = level;
            _game = game;

            x = -500;

            var background = new Sprite(UtilStrings.SpritesPause + "background_pause.png");
            background.SetOrigin(0, background.height/2);
            background.y = game.height/2;

            var header = new Sprite(UtilStrings.SpritesPause + "header_pause.png");
            header.SetOrigin(header.width/2, header.height/2);
            header.SetXY(background.width/2, 200);

            _buttons = new[]
            {
                new Button(UtilStrings.SpritesPause + "button_resume.png", 2, background.width/2, 350, "Resume"),
                new Button(UtilStrings.SpritesPause + "button_restart.png", 2, background.width/2, 450,
                    _level.GetLevelName()),
                new Button(UtilStrings.SpritesPause + "button_exit.png", 2, background.width/2, 550, "MainMenu")
            };

            AddChild(background);
            AddChild(header);
            foreach (var button in _buttons)
            {
                AddChild(button);
            }

            _selectedSound = new Sound(UtilStrings.SoundsMenu + "sound_selected.wav");
            _openSound = new Sound(UtilStrings.SoundsMenu + "sound_pause.wav");
        }
Example #3
0
        public Credits(NeonArkanoidGame game) : base()
        {
            _game = game;
            SetBackground();

            _buttons = new[]
            {
                new Button(UtilStrings.SpritesMenu + "/Credits/back.png", 2, 1500, 680, "MainMenu"),
            };
            foreach (var button in _buttons)
            {
                AddChild(button);
            }
            _buttons[0].Selected();

            _selectedSound = new Sound(UtilStrings.SoundsMenu + "sound_selected.wav");
        }
Example #4
0
        public Credits(NeonArkanoidGame game)
            : base()
        {
            _game = game;
            SetBackground();

            _buttons = new[]
               {
                new Button(UtilStrings.SpritesMenu + "/Credits/back.png", 2, 1500, 680, "MainMenu"),
            };
            foreach (var button in _buttons)
            {
                AddChild(button);
            }
            _buttons[0].Selected();

            _selectedSound = new Sound(UtilStrings.SoundsMenu + "sound_selected.wav");
        }
Example #5
0
        public Level(string filename, NeonArkanoidGame game) //: base(game.width, game.height)
        {
            width   = game.width;
            _height = game.height;

            SetBackground();
            SetPolyField();
            SetTextBoxSettings();
            BoundaryCreator();
            SetSounds();

            _gameEnded = false;
            _levelName = filename.Remove(filename.Length - 4);
            Console.WriteLine(_levelName);
            _game = game;

            var tmxParser = new TMXParser();

            _map = tmxParser.Parse(filename);

            for (var i = 0; i < _map.ObjectGroup.Length; i++)
            {
                if (_map.ObjectGroup[i].Name.ToLower() == "polygons" || _map.ObjectGroup[i].Name.ToLower() == "polygon")
                {
                    _polyList = new List <Polygon>();
                    CreatePolygons(_map.ObjectGroup[i]);
                }
            }
            foreach (var polygon in _polyList)
            {
                AddChild(polygon);
            }

            AddBouncerBalls();
            AddBumpers();

            _ball = new Ball(30, new AnimationSprite(UtilStrings.SpritesPlayer + "ball.png", 5, 1), new Vec2(200, 200));
            AddChild(_ball);
            _stuckToPaddle = true;

            _paddle = new Paddle(this, new Vec2(game.width / 2, game.height - 100));
            AddChild(_paddle);
            Redraw();
        }
Example #6
0
        //: base(game.width, game.height)
        public Level(string filename, NeonArkanoidGame game)
        {
            width = game.width;
            _height = game.height;

            SetBackground();
            SetPolyField();
            SetTextBoxSettings();
            BoundaryCreator();
            SetSounds();

            _gameEnded = false;
            _levelName = filename.Remove(filename.Length - 4);
            Console.WriteLine(_levelName);
            _game = game;

            var tmxParser = new TMXParser();
            _map = tmxParser.Parse(filename);

            for (var i = 0; i < _map.ObjectGroup.Length; i++)
            {
                if (_map.ObjectGroup[i].Name.ToLower() == "polygons" || _map.ObjectGroup[i].Name.ToLower() == "polygon")
                {
                    _polyList = new List<Polygon>();
                    CreatePolygons(_map.ObjectGroup[i]);
                }
            }
            foreach (var polygon in _polyList)
            {
                AddChild(polygon);
            }

            AddBouncerBalls();
            AddBumpers();

            _ball = new Ball(30, new AnimationSprite(UtilStrings.SpritesPlayer + "ball.png", 5, 1), new Vec2(200, 200));
            AddChild(_ball);
            _stuckToPaddle = true;

            _paddle = new Paddle(this, new Vec2(game.width/2, game.height - 100));
            AddChild(_paddle);
            Redraw();
        }
Example #7
0
        public WinScreen(NeonArkanoidGame game) : base()
        {
            _game = game;
            tm    = new TweenManager();
            Tween.RegisterAccessor(typeof(Sprite), new SpriteAccessor());

            mySprite = new Sprite("../assets/sprite/ui/W1.png");
            mySprite.SetOrigin(mySprite.width / 2, mySprite.height / 2);
            AddChild(mySprite);

            mySprite2 = new Sprite("../assets/sprite/ui/W2.png");
            mySprite2.SetOrigin(0, 0);
            AddChild(mySprite2);

            myTimelime.Push(Tween.To(mySprite, SpriteAccessor.XY, 2000).Target(_game.width / 2, _game.height / 2).Ease(TweenEquations.easeInExpo));
            myTimelime.Start(tm);
            myTimelime2.Push(Tween.From(mySprite2, SpriteAccessor.XY, 2000).Target(_game.width, _game.height).Ease(TweenEquations.easeInExpo));
            myTimelime2.Start(tm);
        }
Example #8
0
 public MainMenu(NeonArkanoidGame game)
 {
     _game = game;
     SetBackground();
     SetHeader();
     _buttons = new[]
     {
         new Button(UtilStrings.SpritesMenu + "Start.png", 2, 1500, 207, "Level1"),
         new Button(UtilStrings.SpritesMenu + "credits.png", 2, 1498, 370, "Credits"),
         new Button(UtilStrings.SpritesMenu + "quit.png", 2, 1502, 537, "Exit")
     };
     foreach (var button in _buttons)
     {
         AddChild(button);
     }
     _buttons[0].Selected();
     _selectedSound = new Sound(UtilStrings.SoundsMenu + "sound_selected.wav");
     var music = new Sound(UtilStrings.SoundsMenu + "Menu.ogg", true, true);
     _musicChannel = music.Play();
 }
Example #9
0
        public WinScreen(NeonArkanoidGame game)
            : base()
        {
            _game = game;
            tm = new TweenManager();
            Tween.RegisterAccessor(typeof(Sprite), new SpriteAccessor());

            mySprite = new Sprite("../assets/sprite/ui/W1.png");
            mySprite.SetOrigin(mySprite.width / 2, mySprite.height / 2);
            AddChild(mySprite);

            mySprite2 = new Sprite("../assets/sprite/ui/W2.png");
            mySprite2.SetOrigin(0, 0);
            AddChild(mySprite2);

            myTimelime.Push(Tween.To(mySprite, SpriteAccessor.XY, 2000).Target(_game.width / 2, _game.height / 2).Ease(TweenEquations.easeInExpo));
            myTimelime.Start(tm);
            myTimelime2.Push(Tween.From(mySprite2, SpriteAccessor.XY, 2000).Target(_game.width, _game.height).Ease(TweenEquations.easeInExpo));
            myTimelime2.Start(tm);
        }
Example #10
0
        public MainMenu(NeonArkanoidGame game)
        {
            _game = game;
            SetBackground();
            SetHeader();
            _buttons = new[]
            {
                new Button(UtilStrings.SpritesMenu + "Start.png", 2, 1500, 207, "Level1"),
                new Button(UtilStrings.SpritesMenu + "credits.png", 2, 1498, 370, "Credits"),
                new Button(UtilStrings.SpritesMenu + "quit.png", 2, 1502, 537, "Exit")
            };
            foreach (var button in _buttons)
            {
                AddChild(button);
            }
            _buttons[0].Selected();
            _selectedSound = new Sound(UtilStrings.SoundsMenu + "sound_selected.wav");
            var music = new Sound(UtilStrings.SoundsMenu + "Menu.ogg", true, true);

            _musicChannel = music.Play();
        }