Beispiel #1
0
        public void AddCoins()
        {
            // Create cnt * cnt polygons
            int     cnt  = 6;
            float   rad  = 0.2f;
            Texture texN = TextureLoader.FromFile(device, "../../../QuestionCoin.png");

            for (int i = 0; i < cnt; i++)
            {
                float x = (float)((0.5f) + (playingW - rad * (cnt + 1)) / cnt * i);
                float y = (float)(random.Next(1, 3) * (playingH - 2f) / 3 + 1.2f);


                for (int j = 1; j <= cnt; j++)
                {
                    Ngon p = new Ngon();

                    p.Rad = 0.2f;
                    p.DrawNgon(10, p.Rad);
                    p.Tex = texN;



                    if (x + 0.5f * j < playingW - 0.4f)
                    {
                        p.P = new Vector2((float)(x + 0.5f * j),
                                          (float)(y));
                        coins.Add(p);

                        world.Add(p);
                    }
                }
            }
        }//end AddCoins
Beispiel #2
0
        public void AddNgon()
        {
            float worldW = Width - 0.4f;
            float worldH = Height - 0.6f;
            // Create cnt * cnt polygons
            int   cnt = 6;
            float rad = 0.5f;

            for (int i = 0; i < cnt; i++)
            {
                float x = (float)((0.5f) + (playingW - rad * (cnt + 1)) / cnt * i);
                float y = (float)(random.Next(1, 3) * (playingH - 2f) / 3 + 1.2f);

                for (int j = 1; j <= cnt; j++)
                {
                    Ngon p = new Ngon();
                    p.Color = Color.Transparent;
                    p.DrawNgon(10, rad);

                    if (x + 0.5f * j < playingW - 0.4f)
                    {
                        p.P = new Vector2((float)(x + 0.5f * j),
                                          (float)(y));
                        coins.Add(p);

                        world.Add(p);
                    }
                }
            }
        }    //end AddNgon