示例#1
0
        private void DrawLanderExplosion()
        {
            //The draws each section of the lander
            foreach (Vector2 v2 in LanderValues.TopLines())
            {
                float Xrotated = topCenter.X + (v2.X - topCenter.X) *
                                 (float)Math.Cos(topRotation) - (v2.Y - topCenter.Y) *
                                 (float)Math.Sin(topRotation);

                float Yrotated = topCenter.Y + (v2.X - topCenter.X) *
                                 (float)Math.Sin(topRotation) + (v2.Y - topCenter.Y) *
                                 (float)Math.Cos(topRotation);

                pb.AddVertex((new Vector2(Xrotated, Yrotated) * scale) + topPosition, Color.White);//Color of the lander
            }

            foreach (Vector2 v2 in LanderValues.CapsuleLines())
            {
                float Xrotated = capsuleCenter.X + (v2.X - capsuleCenter.X) *
                                 (float)Math.Cos(capsuleRotation) - (v2.Y - capsuleCenter.Y) *
                                 (float)Math.Sin(capsuleRotation);

                float Yrotated = capsuleCenter.Y + (v2.X - capsuleCenter.X) *
                                 (float)Math.Sin(capsuleRotation) + (v2.Y - capsuleCenter.Y) *
                                 (float)Math.Cos(capsuleRotation);

                pb.AddVertex((new Vector2(Xrotated, Yrotated) * scale) + capsulePosition, Color.White);//Color of the lander
            }

            foreach (Vector2 v2 in LanderValues.LeftLegLines())
            {
                float Xrotated = leftLegCenter.X + (v2.X - leftLegCenter.X) *
                                 (float)Math.Cos(leftLegRotation) - (v2.Y - leftLegCenter.Y) *
                                 (float)Math.Sin(leftLegRotation);

                float Yrotated = leftLegCenter.Y + (v2.X - leftLegCenter.X) *
                                 (float)Math.Sin(leftLegRotation) + (v2.Y - leftLegCenter.Y) *
                                 (float)Math.Cos(leftLegRotation);

                pb.AddVertex((new Vector2(Xrotated, Yrotated) * scale) + leftLegPosition, Color.White);//Color of the lander
            }

            foreach (Vector2 v2 in LanderValues.RightLegLines())
            {
                float Xrotated = rightLegCenter.X + (v2.X - rightLegCenter.X) *
                                 (float)Math.Cos(rightLegRotation) - (v2.Y - rightLegCenter.Y) *
                                 (float)Math.Sin(rightLegRotation);

                float Yrotated = rightLegCenter.Y + (v2.X - rightLegCenter.X) *
                                 (float)Math.Sin(rightLegRotation) + (v2.Y - rightLegCenter.Y) *
                                 (float)Math.Cos(rightLegRotation);

                pb.AddVertex((new Vector2(Xrotated, Yrotated) * scale) + rightLegPosition, Color.White);//Color of the lander
            }

            if (Sound.isExplosionFinished()) //Stop Crashing
            {
                landerCrashed = true;
            }
        }
示例#2
0
        private void DrawLanderRocket()
        {
            foreach (Vector2 v2 in LanderValues.GetRocketCords(rocket1))
            {
                float Xrotated = center.X + (v2.X - center.X) *
                                 (float)Math.Cos(rotation) - (v2.Y - center.Y) *
                                 (float)Math.Sin(rotation);

                float Yrotated = center.Y + (v2.X - center.X) *
                                 (float)Math.Sin(rotation) + (v2.Y - center.Y) *
                                 (float)Math.Cos(rotation);

                pb.AddVertex((new Vector2(Xrotated, Yrotated) * scale) + position, Color.Red);
            }
        }
示例#3
0
        private void DrawLander()
        {
            foreach (Vector2 v2 in LanderValues.FillLanderLines())
            {
                float Xrotated = center.X + (v2.X - center.X) *
                                 (float)Math.Cos(rotation) - (v2.Y - center.Y) *
                                 (float)Math.Sin(rotation);

                float Yrotated = center.Y + (v2.X - center.X) *
                                 (float)Math.Sin(rotation) + (v2.Y - center.Y) *
                                 (float)Math.Cos(rotation);

                pb.AddVertex((new Vector2(Xrotated, Yrotated) * scale) + position, Color.White);//Color of the lander
            }
        }
示例#4
0
        public Lander(Game game) : base(game)
        {
            RandomLanderPos();
            landerCords = LanderValues.FillLanderLines();

            this.pb = GlobalValues.PrimitiveBatch;

            showRocket1            = false;
            showRocket2            = false;
            rotationMatrix         = new Matrix();
            currentLanderDirection = new Vector2();
            isThrusting            = false;

            scale            = 2.0f;
            center           = new Vector2(5.5f, 4.5f);
            particleConstant = LanderValues.ParticleConstant;

            thrustPower           = 0.0f;
            thrustPowerIncrement  = 0.1f; //Needs adjustment
            gravityConstant       = MOON_GRAVITY;
            gravityPull           = gravityConstant;
            LanderValues.Velocity = new Vector2();
        }