public Butterfly(GameplayScreen screen)
            : base(screen)
        {
            Radius = 4;

            Vector3 initPos = new Vector3();
            initPos.X = MathHelper.Lerp(screen.world.Limits.Min.X, screen.world.Limits.Max.X, screen.random.NextFloat());
            initPos.Y = MathHelper.Lerp(screen.world.Limits.Min.Y, screen.world.Limits.Max.Y, screen.random.NextFloat());
            initPos.Z = 0;

            Position = initPos;

            MaxForce = 5 * 1.65f;
            MaxSpeed = MathHelper.Lerp(8, 12, screen.random.NextFloat()) * 1.65f;

            MaxSpeed = 75;
            MaxForce = 3 * MaxSpeed;

            Speed = MathHelper.Lerp(MaxSpeed / 2, MaxSpeed, screen.random.NextFloat());

            float angle = (float)(screen.random.NextFloat() * MathHelper.TwoPi);
            Velocity = new Vector3((float)Math.Cos(angle), (float)Math.Sin(angle), 0) * Speed;

            alpha = new Controller(screen.random.NextFloat(),
                MathHelper.Lerp(0.4f, 0.8f, screen.random.NextFloat()), 0, 1, Controller.Mode.OSCILLATE);
            radiusOffset = new Controller(
                screen.random.NextFloat() * 4 - 2, 50, -2, 2, Controller.Mode.OSCILLATE);

            Controller animSpeed = new Controller(2, 1, 3, 7, Controller.Mode.OSCILLATE);
            anim = new AnimController(animSpeed);
        }
Example #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="screen">gameplay screen</param>
        public Player(GameplayScreen screen)
            : base(screen)
        {
            Radius = 8;
            Position = new Vector3(0,0,0);
            MaxSpeed = 75;
            MaxForce = 3 * MaxSpeed;
            Speed = 0;

            Controller animSpeed = new Controller(2, 1, 2, 3, Controller.Mode.OSCILLATE);
            anim = new AnimController(animSpeed);

            ghostEffect = new GhostEffect(screen, this);
            sonar = new Sonar(screen);
        }