Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
- {
- int numberProjectiles = 10;
- for (int i = 0; i < numberProjectiles; i++)
- {
- Vector2 muzzleOffset = Vector2.Normalize(new Vector2(speedX, speedY));
- if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
- {
- position += muzzleOffset;
- //should set the shots to originate at the muzzle? is there a variable the example doesn't give that I should have here?
- }
- Vector2 perturbedSpeed = new Vector2(speedX, speedY).RotatedByRandom(MathHelper.ToRadians(35)); // 30 degree spread.
- Projectile.NewProjectile(position.X, position.Y, perturbedSpeed.X, perturbedSpeed.Y, type, damage, knockBack, player.whoAmI);
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement