コード例 #1
0
        /// <summary>
        /// Creates a new sprite with a random texture and transform
        /// </summary>
        private void addSprite()
        {
            // Assign random texture
            Sprite s = new Sprite(textures.ElementAt(r.Next(0, textures.Count)).Value, 50, 50);

            // Transform sprite randomly
            s.Position = new Vector2(r.Next(-8000, 8000), r.Next(-6000, 6000));
            float scale = 300.0f * (float) r.NextDouble() + 0.5f;
            s.Size = new SizeF(scale, scale);
            s.Rotation = (float) r.NextDouble() * 2.0f * 3.141f;

            sprites.Add(s);
        }