public IntervalShoot(Enemy parent, double newInterval, BulletPool.BulletType type) { interval = newInterval; bulletType = type; timeSinceLastShot = 0; }
public void add(float newX, float newY, BulletPool.BulletType newType, GameTime entryTime, float direction) { if (newType == BulletPool.BulletType.TestBullet || newType == BulletPool.BulletType.Bucket || newType == BulletPool.BulletType.Heart || newType == BulletPool.BulletType.Brain || newType == BulletPool.BulletType.Lung) { creation(); } initialBucketVelocity = Vector2.Zero; inUse = true; timePassed = 0; type = newType; horizontal_pos = newX; vertical_pos = newY; exploding = false; explodingTime = 0; removeFromGame = false; pole = Polarity.Neutral; magneticMoment = 0.5f; if (type == BulletPool.BulletType.Lung) { organVelocityX = (float)((Game1.gameRandom.Next() % 1.2 + 1.0) * 0.12f); organVelocityY = (float)((Game1.gameRandom.Next() % 1 + 1.0) * 0.32f); } if (type == BulletPool.BulletType.Heart || type == BulletPool.BulletType.healthItem) { organVelocityX = (float)((Game1.gameRandom.Next() % 1.2 + 1.0) * 0.13f); organVelocityY = (float)((Game1.gameRandom.Next() % 1 + 1.0) * 0.4f); } if (type == BulletPool.BulletType.Brain) { organVelocityX = (float)((Game1.gameRandom.Next() % 1.2 + 1.0) * 0.14f); organVelocityY = (float)((Game1.gameRandom.Next() % 1 + 1.0) * 0.4f); } switch (newType) { case BulletPool.BulletType.TestBullet: width= 31.5f; height = 31.5f; velocity.X = (float)(testBulletVelocity * Math.Cos(direction)); velocity.Y = (float)(testBulletVelocity * Math.Sin(direction)); rotation = direction; break; case BulletPool.BulletType.LavaBlob: width = 31.5f; height = 31.5f; velocity.X = 0.0f; velocity.Y = 0.375f; currentAnimation = "fireball"; maxLifeTime = 1500; rotation = 0.0f; break; case BulletPool.BulletType.Bucket: width = 16f; height = 16f; velocity.X = (float)(testBulletVelocity * Math.Cos(direction)); velocity.Y = (float)(testBulletVelocity * Math.Sin(direction)); initialBucketVelocity.X = velocity.X; initialBucketVelocity.Y = velocity.Y; rotation = direction; maxLifeTime = 1500; currentAnimation = "bucket"; currentFrame = 0; lastFrameIncrement = entryTime.TotalGameTime.Milliseconds; break; case BulletPool.BulletType.Heart: width = 31.5f; height = 31.5f; velocity.X = (float)(organVelocityX * Math.Cos(direction)); velocity.Y = (float)(organVelocityY * Math.Sin(direction)); rotation = direction; currentAnimation = "heartIdle2"; acceleration.Y = 0.0005f; maxLifeTime = 50000; bulletUsed = false; currentFrame = 0; lastFrameIncrement = entryTime.TotalGameTime.Milliseconds; break; case BulletPool.BulletType.Brain: width = 31.5f; height = 31.5f; velocity.X = (float)(organVelocityX * Math.Cos(direction)); velocity.Y = (float)(organVelocityY * Math.Sin(direction)); rotation = direction; currentAnimation = "brainIdle"; maxLifeTime = 50000; acceleration.Y = 0.0007f; bulletUsed = false; currentFrame = 0; lastFrameIncrement = entryTime.TotalGameTime.Milliseconds; break; case BulletPool.BulletType.Lung: width = 31.5f; height = 31.5f; velocity.X = (float)(organVelocityX * Math.Cos(direction)); velocity.Y = (float)(organVelocityY * Math.Sin(direction)); rotation = direction; currentAnimation = "lungIdle"; currentFrame = 0; acceleration.Y = 0.0003f; bulletUsed = false; lastFrameIncrement = entryTime.TotalGameTime.Milliseconds; maxLifeTime = 50000; break; case BulletPool.BulletType.healthItem: width = 31.5f; height = 31.5f; velocity.X = (float)(organVelocityX * Math.Cos(direction)); velocity.Y = (float)(organVelocityY * Math.Sin(direction)); rotation = direction; currentAnimation = "heartIdle"; acceleration.Y = 0.0005f; maxLifeTime = 2000; bulletUsed = false; currentFrame = 0; lastFrameIncrement = entryTime.TotalGameTime.Milliseconds; break; default: inUse = false; death(); break; } }