예제 #1
0
        public void StartGame(string MenuFileSelected, string AmountOfPlayers, bool sound, bool effects)
        {
            map = new Map(@"Maps\" + MapSelected + ".xml", this.Game);
            this.Game.Components.Add(map);

            ScreenTitle += " (" + map.Name + ")";
            this.Game.Window.Title = ScreenTitle;

            music = new Audio("Menu", AudioSettings, AudioWaveBank, AudioSoundsBank, this.Game);
            this.Game.Components.Add(music);

            if (sound)
            {
                //Add sound
            }

            if (effects)
            {
                //Add effects
            }

            Controls controls1 = new Controls();
            controls1.Up = Keys.W;
            controls1.Down = Keys.S;
            controls1.Left = Keys.A;
            controls1.Right = Keys.D;
            controls1.Drop = Keys.Q;

            Controls controls2 = new Controls();
            controls2.Up = Keys.I;
            controls2.Down = Keys.K;
            controls2.Left = Keys.J;
            controls2.Right = Keys.L;
            controls2.Drop = Keys.U;

            characters.Add(new Character(map, controls1, 17, @"Sprites\White", this.Game, characters));
            this.Game.Components.Add(characters[0]);

            characters.Add(new Character(map, controls2, 29, @"Sprites\Green", this.Game, characters));
            this.Game.Components.Add(characters[1]);

            if (AmountOfPlayers == "3 players" || AmountOfPlayers == "4 players")
            {
                Controls controls3 = new Controls();
                controls3.Up = Keys.Up;
                controls3.Down = Keys.Down;
                controls3.Left = Keys.Left;
                controls3.Right = Keys.Right;
                controls3.Drop = Keys.RightControl;

                characters.Add(new Character(map, controls3, 167, @"Sprites\Red", this.Game, characters));
                this.Game.Components.Add(characters[2]);

                if (AmountOfPlayers == "4 players")
                {
                    Controls controls4 = new Controls();
                    controls4.Up = Keys.NumPad8;
                    controls4.Down = Keys.NumPad2;
                    controls4.Left = Keys.NumPad4;
                    controls4.Right = Keys.NumPad6;
                    controls4.Drop = Keys.NumPad0;

                    characters.Add(new Character(map, controls4, 179, @"Sprites\Black", this.Game, characters));
                    this.Game.Components.Add(characters[3]);
                }
            }
        }
예제 #2
0
 public Character(Map map, Controls controls, int currentTile, string sprite, Game game, List<Character> characterList)
     : base(game)
 {
     this.characterList = characterList;
     this.map = map;
     this.controls = controls;
     this.parent = game;
     this.currentTile = currentTile;
     this.sprite = sprite;
     this.direction = CharDirection.Down;
     this.charSpawnLocation = currentTile;
     this.x = ((currentTile % this.map.MapSize.Width) - 1) * this.map.SpriteSize.Width;
     this.y = (float)Math.Floor((decimal)(currentTile / this.map.MapSize.Width)) * this.map.SpriteSize.Height;
     this.baseX = this.x;
     this.baseY = this.y;
 }