Example #1
0
 public override Projectile generateProjectiles(Vector2 pos, Spell spell, GameHandler game, Entity target, Entity owner)
 {
     Vector2 dir;
     if (target != null)
     {
         dir = target.pos - pos;
     }
     else
     {
         dir = game.posFromScreenPos(Main.newMouseState.Position.ToVector2()) - pos;//dir = game.player.dir.Vector();
     }
     dir.Normalize();
     return new ProjectileBall(spell, game, target, owner, pos, dir, speed);
 }
Example #2
0
        public override Projectile generateProjectiles(Vector2 origin, Spell spell, GameHandler game, Entity target, Entity owner)
        {
            Vector2 dir;
            if (target != null)
            {
                dir = target.pos - origin;
            }
            else
            {
                dir = game.posFromScreenPos(Main.newMouseState.Position.ToVector2()) - origin;//dir = game.player.dir.Vector();
            }
            dir.Normalize();

            ProjectileStream projReturn = new ProjectileStream(spell, game, target, owner);

            float maxMult = projReturn.ProcessCollision(origin, dir * length);

            float mult;
            for (int i = 0; i < partCount; i++)
            {
                mult = (float)random.NextDouble();
                if (mult < maxMult)
                {
                    projReturn.addProjectile(origin + dir * length * mult);
                }
            }

            return projReturn;
        }