Ejemplo n.º 1
0
        public static void SpreadShot(Vector2 pos, SpriteBatch sb, EntityManager em, Entity owner, float bulletSpeed, string texture, float direction, float spread, int amount)
        {
            if (amount % 2 != 0)
            {
                em.AddEntity(new EnemyBullet(pos, sb, em, owner, new Vector2((float)Math.Cos(direction) * bulletSpeed, (float)Math.Sin(direction) * bulletSpeed), texture));
            }

            for (int i = amount / 2; i > 0; i--)
            {
                em.AddEntity(new EnemyBullet(pos, sb, em, owner, new Vector2((float)Math.Cos(direction - Math.PI / (spread / i)) * bulletSpeed, (float)Math.Sin(direction - Math.PI / (spread / i)) * bulletSpeed), texture));
                em.AddEntity(new EnemyBullet(pos, sb, em, owner, new Vector2((float)Math.Cos(direction + Math.PI / (spread / i)) * bulletSpeed, (float)Math.Sin(direction + Math.PI / (spread / i)) * bulletSpeed), texture));
            }
        }
Ejemplo n.º 2
0
        private void SpawnCloud(float y)
        {
            float x      = Global.random.Next(-Global.outOfScreenMargin, Global.playingFieldWidth + Global.outOfScreenMargin);
            float alpha  = (float)Global.random.NextDouble() * (MAX_ALPHA - MIN_ALPHA) - MIN_ALPHA;
            float speed  = GetSpeed();
            bool  mirror = Global.random.NextDouble() > .5;

            _entityManager.AddEntity(new Cloud(new Vector2(x, y), _spriteBatch, _entityManager, RandomCloudTexture(), alpha, speed, mirror));
        }