Example #1
0
 private void Generate(int x)
 {
     var playerX = x + (int)(24 * textureScale);
     var waterdropX = gaussianRandom.Next(playerX, 30);
     var waterdrop = new Waterdrop(game)
     {
         X = (int)waterdropX,
         Y = (int)(-10 * textureScale),
         Width = (int)(8 * textureScale),
         Height = (int)(8 * textureScale),
         HorizontalSpeed = 0,
         VerticalSpeed = 140 * textureScale,
     };
     scene.AddWaterDrop(waterdrop);
 }
Example #2
0
        public void Generate(int playerX, int playerY)
        {
            var waterdropX = playerX + (int)(20 * textureScale);
            var waterdropY = playerY + (int)(8 * textureScale);
            var dx = game.Input.X - waterdropX;
            var dy = game.Input.Y - waterdropY;
            var angle = -MathHelper.PiOver2 + gaussianRandom.Next(0, 0.3);
            var distance = 200 * textureScale;
            var hSpeed = Math.Cos(angle) * distance;
            var vSpeed = Math.Sin(angle) * distance;
            var waterdrop = new Waterdrop(game)
            {
                X = waterdropX,
                Y = waterdropY,
                Width = (int)(8 * textureScale),
                Height = (int)(8 * textureScale),
                HorizontalSpeed = hSpeed,
                VerticalSpeed = vSpeed,
            };

            scene.AddWaterDrop(waterdrop);
        }
Example #3
0
 public void AddWaterDrop(Waterdrop waterdrop)
 {
     waterdrops.Add(waterdrop);
 }
Example #4
0
 public bool IntersectWithWaterdrop(Waterdrop waterdrop)
 {
     return Math.Pow(waterdrop.X - Bounds.Center.X, 2) +
         Math.Pow(waterdrop.Y - Bounds.Center.Y, 2) < Math.Pow(Width / 3, 2);
 }