Ejemplo n.º 1
0
        public override void Clear()
        {
            platforms.Clear();
            field.Clear();

            player1 = null;
            player2 = null;
        }
Ejemplo n.º 2
0
        public override void Initialize()
        {
            int width = Globals.tileWidth;
            int height = Globals.tileHeight;

            for (int y = 0; y <= Levels.level1Grid.GetUpperBound(0); y++)
                for (int x = 0; x <= Levels.level1Grid.GetUpperBound(1); x++)
                {
                    if (Levels.level1Grid[y, x] == 1)
                        platforms.Add(new Rectangle(x * width, y * height, width, 4));
                    else if (Levels.level1Grid[y, x] == 2)
                        player1 = new NormalPlayer(new Vector2(x * width, y * height), Color.Red);
                    else if (Levels.level1Grid[y, x] == 3)
                        player2 = new NormalPlayer(new Vector2(x * width, y * height), Color.Blue);
                }

            foreach (Rectangle pl in platforms)
                field.Add(Assets.CreateRectangle(pl));

            player1.SetKeys(Keys.A, Keys.W, Keys.D, Keys.E, Keys.S, Keys.Q);
            player2.SetKeys(Keys.Left, Keys.Up, Keys.Right, Keys.End, Keys.Down, Keys.RightShift);
        }