Esempio n. 1
0
File: game.cs Progetto: tpsa/pwsg
        public game(Game1 g)
        {
            sec = new Seconder();
            this.g = g;
            settings = new CSettings();
            RefreshRate = 20;
            music = new Music();
            points = 0;
            lifes = 3;
            MaxTime = 10;
            TimeLeft = MaxTime;
            sec.seconderTrigger += SecHandler;
            GameFinished += GameFinishedHandler;
            GameStarted += GameStartedHandler;
            GameDraw += GameDrawHandler;
            GamePaused += GamePausedHandler;
            GameOver += GameOverHandler;
            b = new Board.Board(this, "map.xml");
            b.player = new HumanPlayer(this);

            Player op = new Usmiech(this);
            op.LocX = 9;
            op.LocY = 9;
            op.gotox = op.LocX;
            op.gotoy = op.LocY;
            b.opponents = new List<Player>();
            b.opponents.Add(op);
        }
Esempio n. 2
0
File: Board.cs Progetto: tpsa/pwsg
        public void GenerateOpponents()
        {
            int ile = opponents.Count;
            if (ile > 4) return;
            int ile_wypro = Math.Max(4 - ile, 0);

            for (int i = 0; ile_wypro >= 0 && i < Height; i++)
                for (int j = 0; ile_wypro >= 0 && j < Width; j++)
                {
                    if (IsFree(j, i))
                    {
                        int los = r.Next() % 100;
                        if (los < 5)
                        {
                            Balon b = new Balon(g);
                            b.LocX = j;
                            b.LocY = i;
                            b.gotox = j;
                            b.gotoy = i;
                            --ile_wypro;
                            opponents.Add(b);
                            continue;
                        }
                        if (los < 10)
                        {
                            Gabka d = new Gabka(g);
                            d.LocX = j;
                            d.LocY = i;
                            d.gotox = j;
                            d.gotoy = i;
                            --ile_wypro;
                            opponents.Add(d);
                            continue;
                        }
                        if (los < 15)
                        {
                            Duch gab = new Duch(g);
                            gab.LocX = j;
                            gab.LocY = i;
                            gab.gotox = j;
                            gab.gotoy = i;
                            --ile_wypro;
                            continue;
                        }
                        if (los < 20)
                        {
                            Kropla k = new Kropla(g);
                            k.LocX = j;
                            k.LocY = i;
                            k.gotox = j;
                            k.gotoy = i;
                            --ile_wypro;
                            continue;
                        }
                        if (los < 50)
                        {
                            Usmiech u = new Usmiech(g);
                            u.LocX = j;
                            u.LocY = i;
                            u.gotox = j;
                            u.gotoy = i;
                            --ile_wypro;
                            continue;
                        }
                    }
                }
        }