Exemplo n.º 1
0
 public void FillCoin(Coin coin, int id)
 {
     int r = coin.size / 2;
     for (int i = -r; i <= r; i++)
         for (int j = -r; j <= r; j++)
             if ((i * i) + (j * j) <= r * r)
                 // disallow snake overriding
                 if (!pointsHistory.ContainsKey(field[coin.x + i, coin.y + j]))
                     field[coin.x + i, coin.y + j] = id;
 }
Exemplo n.º 2
0
        void createCoin()
        {
            Coin c = new Coin(259, 0, 3, 20, GetNewId());
            c.ChangeLocation(randomPosition(20, gameField.Width), randomPosition(20, gameField.Height));

            GetCollisions().FillCoin(c, c.id);

            coins.Add(c);
        }