Example #1
0
        private void Paste()
        {
            if (_myClipboard.Count == 0)
            {
                return;
            }

            _selectedObjects.Clear();

            foreach (RadarBlip blip in _myClipboard)
            {
                // Clone this object
                RadarBlip tempBlip = Scenes.CloneBlip(blip, _map);

                // Figure out where to place the pasted object
                MyVector newPosition = tempBlip.Sphere.Position - _clipboardPositionCenter;
                newPosition.Add(_curMousePoint);
                tempBlip.Sphere.Position.StoreNewValues(newPosition);

                // Add it
                _selectedObjects.Add(tempBlip.Token);
                _map.Add(tempBlip);
            }

            _mode = SelectionMode.Selected;
        }
Example #2
0
        private void DrawAttatchment(MyVector offset, AttatchementType attatchment)
        {
            MyVector worldAttatchment = _ship.Ball.Rotation.GetRotatedVector(offset, true);

            worldAttatchment.Add(_ship.Ball.Position);

            switch (attatchment)
            {
            case AttatchementType.Thruster:
                _picturebox.FillCircle(Color.Silver, worldAttatchment, 60d);
                _picturebox.DrawCircle(Color.Black, 1d, worldAttatchment, 60d);
                break;

            case AttatchementType.Tractor:
                _picturebox.FillCircle(Color.Olive, worldAttatchment, 40d);
                _picturebox.DrawCircle(Color.Black, 1d, worldAttatchment, 40d);
                break;

            case AttatchementType.Cannon:
                _picturebox.FillCircle(Color.Brown, worldAttatchment, 30d);
                _picturebox.DrawCircle(Color.Black, 1d, worldAttatchment, 30d);
                break;

            case AttatchementType.MachineGun:
                _picturebox.FillCircle(Color.Brown, worldAttatchment, 25d);
                _picturebox.DrawCircle(Color.Black, 1d, worldAttatchment, 25d);
                break;
            }
        }
Example #3
0
        private void DrawThruster(SolidBall ship, MyVector thruster)
        {
            MyVector worldThruster = _ship.Rotation.GetRotatedVector(thruster, true);

            worldThruster.Add(_ship.Position);

            DrawDot(worldThruster, 3f, Color.Silver);
        }
Example #4
0
        private void CalculateCenterMassWorld()
        {
            MyVector cmWorld = _ship.Rotation.GetRotatedVector(_ship.CenterOfMass, true);

            cmWorld.Add(_ship.Position);

            _centerMassWorld.StoreNewValues(cmWorld);
        }
Example #5
0
        private void DrawThruster(MyVector thruster)
        {
            MyVector worldThruster = _ship.TorqueBall.Rotation.GetRotatedVector(thruster, true);

            worldThruster.Add(_ship.TorqueBall.Position);

            pictureBox1.FillCircle(Color.Silver, worldThruster, 60d);
            pictureBox1.DrawCircle(Color.Black, 1d, worldThruster, 60d);
        }
Example #6
0
        public void Draw()
        {
            if ((_isShiftPressed || _isCtrlPressed) && _myClipboard.Count > 0)
            {
                double opacity = GetPastingBallsOpacity();

                if (opacity > 0d)
                {
                    #region Draw Pasting Balls

                    Ball tempBall = null;

                    foreach (BallBlip blip in _myClipboard)
                    {
                        // Clone the ball
                        tempBall = blip.Ball.CloneBall();

                        // Figure out where to place the pasted object
                        MyVector newPosition = tempBall.Position - _clipboardPositionCenter;
                        newPosition.Add(_curMousePoint);
                        tempBall.Position.StoreNewValues(newPosition);

                        // Draw it
                        if (tempBall is SolidBall)
                        {
                            _renderer.DrawSolidBall((SolidBall)tempBall, ObjectRenderer.DrawMode.Building, blip.CollisionStyle, false, opacity);
                        }
                        else
                        {
                            _renderer.DrawBall(tempBall, ObjectRenderer.DrawMode.Building, blip.CollisionStyle, false, opacity);
                        }
                    }

                    #endregion
                }
            }

            if (_isMouseDown == MouseButtonDown.Left && _mode == SelectionMode.Rectangle)
            {
                #region Draw Rectangle

                MyVector topLeft, bottomRight;
                GetProperCorners(out topLeft, out bottomRight, _mouseDownPoint, _curMousePoint);

                _picturebox.DrawRectangle(Color.Silver, DashStyle.Dash, 1d, topLeft, bottomRight);

                #endregion
            }
            else if (_isMouseDown == MouseButtonDown.Right)
            {
                // Draw Velocity
                _picturebox.DrawLine(Color.Chartreuse, 12d, _mouseDownPoint, _curMousePoint);
            }

            //TODO:  draw the angular velocity
        }
Example #7
0
        /// <summary>
        /// This function draws the vector on the middle of the picturebox (from the middle to the vector coord)
        /// The picturebox is scaled to -10 to 10
        /// </summary>
        private void DrawVector(MyVector vector, Color color)
        {
            const double SCALEFACTOR = 500d / 20d;

            MyVector scaledVector = vector * SCALEFACTOR;

            scaledVector.Y *= -1;      // Invert Y
            scaledVector.Add(250, 250, 0);

            pictureBox1.CreateGraphics().DrawLine(new Pen(color, 5), new Point(250, 250), scaledVector.ToPoint());
        }
Example #8
0
        private void DrawShip(List <MyVector[]> thrustLines)
        {
            // Fill Circle
            Brush brushShip = new SolidBrush(Color.FromArgb(100, Color.LimeGreen));

            pictureBox1.FillCircle(brushShip, _ship.Sphere.Position, _ship.Sphere.Radius);

            brushShip.Dispose();

            // Draw direction facing
            MyVector dirFacing = _ship.Sphere.DirectionFacing.Standard.Clone();

            dirFacing.BecomeUnitVector();
            dirFacing.Multiply(_ship.Sphere.Radius);
            dirFacing.Add(_ship.Sphere.Position);

            pictureBox1.DrawLine(Color.White, 4, _ship.Sphere.Position, dirFacing);

            // Draw an edge
            pictureBox1.DrawCircle(Color.Black, 25d, _ship.Sphere.Position, _ship.Sphere.Radius);

            // Thrust Lines
            foreach (MyVector[] thrustPair in thrustLines)
            {
                MyVector thrustStart = _ship.TorqueBall.Rotation.GetRotatedVector(thrustPair[0], true);
                thrustStart.Add(_ship.TorqueBall.Position);

                MyVector thrustStop = thrustPair[1] * -250d;
                thrustStop.Add(thrustPair[0]);
                thrustStop = _ship.TorqueBall.Rotation.GetRotatedVector(thrustStop, true);
                thrustStop.Add(_ship.TorqueBall.Position);

                pictureBox1.DrawLine(Color.Coral, 40d, thrustStart, thrustStop);
            }

            // Thrusters
            DrawThruster(_shipThrusterOffset_BottomRight);
            DrawThruster(_shipThrusterOffset_BottomLeft);
            DrawThruster(_shipThrusterOffset_TopRight);
            DrawThruster(_shipThrusterOffset_TopLeft);
        }
Example #9
0
        /// <summary>
        /// This will pan my view by the offset passed in.
        /// I will be in static view mode after the function call
        /// </summary>
        public void PanView(MyVector offset, bool shouldTransformViewToWorld, bool enforceBoundryCap)
        {
            // Put myself into static mode
            StaticPoint();

            // Either add what was passed in directly, or convert it from view coords to world coords
            if (shouldTransformViewToWorld)
            {
                _centerPoint.X += GetDistanceViewToWorld(offset.X);
                _centerPoint.Y += GetDistanceViewToWorld(offset.Y);
            }
            else
            {
                _centerPoint.Add(offset);
            }

            if (enforceBoundryCap)
            {
                #region Boundry Check

                //double scaledWidth = (_boundryUpper.X - _boundryLower.X) - (this.Width / _zoom);
                //double scaledHeight = (_boundryUpper.Y - _boundryLower.Y) - (this.Height / _zoom);
                double scaledWidth  = this.Width / _zoom;
                double scaledHeight = this.Height / _zoom;

                // Check left edge
                //if (_centerPoint.X - _boundryLower.X > scaledWidth)
                //{
                //    _centerPoint.X = scaledWidth + _boundryLower.X;
                //}

                //// Check top edge
                //if (_centerPoint.Y - _boundryLower.Y > scaledHeight)
                //{
                //    _centerPoint.Y = scaledHeight + _boundryLower.Y;
                //}

                // Check right edge
                //if (_centerPoint.X + _srcRect.Width < 0)
                //{
                //    _centerPoint.X = 0 - _srcRect.Width;
                //}

                //// Check bottom edge
                //if (_centerPoint.Y + _srcRect.Height < 0)
                //{
                //    _centerPoint.Y = 0 - _srcRect.Height;
                //}

                #endregion
            }
        }
Example #10
0
        private void DrawBall(Ball ball, Color ballColor, Color dirFacingStandColor, Color dirFacingOrthColor)
        {
            // Standard Facing
            MyVector workingVect = ball.DirectionFacing.Standard.Clone();

            workingVect.BecomeUnitVector();
            workingVect.Multiply(ball.Radius);
            workingVect.Add(ball.Position);

            DrawVector(ball.Position, workingVect, dirFacingStandColor);

            // Orthogonal Facing
            workingVect = ball.DirectionFacing.Orth.Clone();
            workingVect.BecomeUnitVector();
            workingVect.Multiply(ball.Radius);
            workingVect.Add(ball.Position);

            DrawVector(ball.Position, workingVect, dirFacingOrthColor);

            // Ball
            DrawBall(ball, ballColor);
        }
Example #11
0
        /// <summary>
        /// This function prunes the list of positions that are too old.  It then figures out the average velocity
        /// of the remaining positions.
        /// </summary>
        private MyVector TimerSprtCalculateVelocity()
        {
            const int RETENTION = 75;           // milliseconds

            int curTick = Environment.TickCount;

            // Add the current to the list
            _prevMousePositions.Add(new MousePosition(_curMousePoint.Clone()));

            #region Prune List

            int lastIndex = -1;
            for (int cntr = _prevMousePositions.Count - 1; cntr >= 0; cntr--)
            {
                if (curTick - _prevMousePositions[cntr].Tick > RETENTION)
                {
                    // This item is too old.  And since the list is in time order, all the entries before this are also too old
                    lastIndex = cntr;
                    break;
                }
            }

            if (lastIndex >= 0)
            {
                //_prevMousePositions.RemoveRange(lastIndex, _prevMousePositions.Count - lastIndex);
                _prevMousePositions.RemoveRange(0, lastIndex + 1);
            }

            #endregion

            #region Calculate Velocity

            MyVector retVal = new MyVector(0, 0, 0);

            // Add up all the instantaneous velocities
            for (int cntr = 0; cntr < _prevMousePositions.Count - 1; cntr++)
            {
                retVal.Add(_prevMousePositions[cntr + 1].Position - _prevMousePositions[cntr].Position);
            }

            // Take the average
            if (_prevMousePositions.Count > 2)          // if count is 0 or 1, then retVal will still be (0,0,0).  If it's 2, then I would be dividing by 1, which is pointless
            {
                retVal.Divide(_prevMousePositions.Count - 1);
            }

            #endregion

            // Exit Function
            return(retVal);
        }
Example #12
0
        private void FireThrusterSprtFire(List <MyVector[]> thrusters, ThrusterKey key)
        {
            foreach (MyVector[] thruster in thrusters)
            {
                _ship.ApplyInternalForce(thruster[0], thruster[1] * _thrustForceMultiplier);

                MyVector offsetWorld = _ship.Rotation.GetRotatedVector(thruster[0], true);
                offsetWorld.Add(_ship.Position);

                MyVector forceWorld = _ship.Rotation.GetRotatedVector(thruster[1], true);

                DrawThrustRunning(offsetWorld, forceWorld, _thrusterColors[key]);
            }
        }
Example #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            MyVector v1 = new MyVector(3, 4, 5);

            v1.Add(1, 2, 3);

            v1.BecomeUnitVector();

            MyVector v2 = v1.Clone();

            v2.Multiply(3);

            v1.Divide(3);
        }
Example #14
0
        private void Copy()
        {
            if (_mode != SelectionMode.Selected || _selectedObjects.Count == 0)
            {
                return;
            }

            _myClipboard.Clear();
            _clipboardPositionCenter = new MyVector();

            foreach (RadarBlip blip in _map.GetAllBlips())
            {
                if (_selectedObjects.Contains(blip.Token))
                {
                    _myClipboard.Add(Scenes.CloneBlip(blip, _map));
                    _clipboardPositionCenter.Add(blip.Sphere.Position);
                }
            }

            if (_myClipboard.Count > 0)
            {
                _clipboardPositionCenter.Divide(_myClipboard.Count);
            }
        }
Example #15
0
        public void Draw()
        {
            if (_type == ShipTypeQual.None)
            {
                return;
            }

            // Fill Circle
            _picturebox.FillCircle(Color.FromArgb(100, Color.LimeGreen), _ship.Sphere.Position, _ship.Sphere.Radius);

            // Draw direction facing
            MyVector dirFacing = _ship.Sphere.DirectionFacing.Standard.Clone();

            dirFacing.BecomeUnitVector();
            dirFacing.Multiply(_ship.Sphere.Radius);
            dirFacing.Add(_ship.Sphere.Position);

            _picturebox.DrawLine(Color.White, 4, _ship.Sphere.Position, dirFacing);

            // Draw an edge
            _picturebox.DrawCircle(Color.Black, 25d, _ship.Sphere.Position, _ship.Sphere.Radius);

            #region Thrust Lines

            foreach (MyVector[] thrustPair in _thrustLines)
            {
                MyVector thrustStart = _ship.Ball.Rotation.GetRotatedVector(thrustPair[0], true);
                thrustStart.Add(_ship.Ball.Position);

                MyVector thrustStop = thrustPair[1] * -250d;
                thrustStop.Add(thrustPair[0]);
                thrustStop = _ship.Ball.Rotation.GetRotatedVector(thrustStop, true);
                thrustStop.Add(_ship.Ball.Position);

                _picturebox.DrawLine(Color.Coral, 40d, thrustStart, thrustStop);
            }

            #endregion
            #region Tractor Effect

            if (_isQPressed || _isQLocked || _isEPressed || _isELocked)
            {
                foreach (TractorBeamCone tractor in _tractorBeams)
                {
                    // Figure out the cone tip location
                    MyVector tractorStart = _ship.Ball.Rotation.GetRotatedVector(tractor.Offset, true);
                    tractorStart.Add(_ship.Ball.Position);

                    // Figure out how bright to draw it
                    int alpha = 0;
                    if (_powerLevel == 1)
                    {
                        alpha = 15;
                    }
                    else if (_powerLevel == 2)
                    {
                        alpha = 30;
                    }
                    else if (_powerLevel == 3)
                    {
                        alpha = 60;
                    }
                    else //if (_powerLevel == 4)
                    {
                        alpha = 128;
                    }

                    // Draw Cone
                    if ((_isQPressed || _isQLocked) && (_isEPressed || _isELocked))
                    {
                        _picturebox.FillPie(Color.FromArgb(alpha, Color.White), tractorStart, tractor.MaxDistance, _ship.Ball.DirectionFacing.Standard, tractor.SweepAngle);
                    }
                    else if (_isQPressed || _isQLocked)
                    {
                        _picturebox.FillPie(Color.FromArgb(alpha, Color.Pink), tractorStart, tractor.MaxDistance, _ship.Ball.DirectionFacing.Standard, tractor.SweepAngle);
                    }
                    else if (_isEPressed || _isELocked)
                    {
                        _picturebox.FillPie(Color.FromArgb(alpha, Color.LightSkyBlue), tractorStart, tractor.MaxDistance, _ship.Ball.DirectionFacing.Standard, tractor.SweepAngle);
                    }
                }
            }

            #endregion
            #region Gun Effect



            #endregion

            #region Thrusters

            if (_type == ShipTypeQual.Ball)
            {
                DrawAttatchment(new MyVector(0, 0, 0), AttatchementType.Thruster);
            }
            else if (_type == ShipTypeQual.SolidBall)
            {
                DrawAttatchment(_thrusterOffset_BottomRight, AttatchementType.Thruster);
                DrawAttatchment(_thrusterOffset_BottomLeft, AttatchementType.Thruster);
                DrawAttatchment(_thrusterOffset_TopRight, AttatchementType.Thruster);
                DrawAttatchment(_thrusterOffset_TopLeft, AttatchementType.Thruster);
            }

            #endregion
            #region Gun

            DrawAttatchment(_cannon.Barrels[0].Offset, AttatchementType.Cannon);

            foreach (ProjectileWeapon weapon in _machineGuns)
            {
                DrawAttatchment(weapon.Barrels[0].Offset, AttatchementType.MachineGun);
            }

            #endregion
            #region Tractor Beam

            // This needs to go after thrusters and guns, because the tractor is smaller, and the ball has everything at zero
            foreach (TractorBeamCone tractor in _tractorBeams)
            {
                DrawAttatchment(tractor.Offset, AttatchementType.Tractor);
            }

            #endregion
        }
Example #16
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            const double GRAVITY       = 20;
            const double THRUSTERFORCE = 30;
            const double ELAPSEDTIME   = .5;

            List <MyVector[]> thrustLines = new List <MyVector[]>();

            #region Color PictureBoxes

            if (_isUpPressed)
            {
                pctUp.BackColor = SystemColors.ControlDark;
            }
            else
            {
                pctUp.BackColor = SystemColors.Control;
            }

            if (_isDownPressed)
            {
                pctDown.BackColor = SystemColors.ControlDark;
            }
            else
            {
                pctDown.BackColor = SystemColors.Control;
            }

            if (_isLeftPressed && radPairedThrusters.Checked)
            {
                pctLeft.BackColor = SystemColors.ControlDark;
            }
            else
            {
                pctLeft.BackColor = SystemColors.Control;
            }

            if (_isRightPressed && radPairedThrusters.Checked)
            {
                pctRight.BackColor = SystemColors.ControlDark;
            }
            else
            {
                pctRight.BackColor = SystemColors.Control;
            }

            if (_isWPressed && radIndependantThrusters.Checked)
            {
                pctW.BackColor = SystemColors.ControlDark;
            }
            else
            {
                pctW.BackColor = SystemColors.Control;
            }

            if (_isSPressed && radIndependantThrusters.Checked)
            {
                pctS.BackColor = SystemColors.ControlDark;
            }
            else
            {
                pctS.BackColor = SystemColors.Control;
            }

            #endregion

            #region Do Physics

            _ship.PrepareForNewTimerCycle();

            if (radIndependantThrusters.Checked)
            {
                #region Independant Thrusters

                if (_isUpPressed)
                {
                    timer2_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_BottomRight, new MyVector(0, -1, 0), THRUSTERFORCE);            // up
                }

                if (_isDownPressed)
                {
                    timer2_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_TopRight, new MyVector(0, 1, 0), THRUSTERFORCE);                // down
                }

                if (_isWPressed)
                {
                    timer2_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_BottomLeft, new MyVector(0, -1, 0), THRUSTERFORCE);             // w
                }

                if (_isSPressed)
                {
                    timer2_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_TopLeft, new MyVector(0, 1, 0), THRUSTERFORCE);         // s
                }

                #endregion
            }
            else
            {
                #region Paired Thrusters

                if (_isUpPressed)
                {
                    timer2_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_BottomRight, new MyVector(0, -1, 0), THRUSTERFORCE);            // up
                    timer2_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_BottomLeft, new MyVector(0, -1, 0), THRUSTERFORCE);             // w
                }

                if (_isDownPressed)
                {
                    timer2_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_TopRight, new MyVector(0, 1, 0), THRUSTERFORCE);        // down
                    timer2_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_TopLeft, new MyVector(0, 1, 0), THRUSTERFORCE);         // s
                }

                if (_isLeftPressed)
                {
                    timer2_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_BottomRight, new MyVector(0, -1, 0), THRUSTERFORCE);    // up
                    timer2_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_TopLeft, new MyVector(0, 1, 0), THRUSTERFORCE);         // s
                }

                if (_isRightPressed)
                {
                    timer2_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_TopRight, new MyVector(0, 1, 0), THRUSTERFORCE);                // down
                    timer2_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_BottomLeft, new MyVector(0, -1, 0), THRUSTERFORCE);             // w
                }

                #endregion
            }

            if (chkShipGravity.Checked)
            {
                _ship.ExternalForce.Add(new MyVector(0, GRAVITY, 0));
            }

            _ship.TimerTestPosition(ELAPSEDTIME);
            _ship.TimerFinish();

            #endregion

            #region Draw

            ClearPictureBox();

            // Ship
            DrawBall(_ship, Color.SteelBlue, Color.LightSteelBlue, Color.DimGray);

            // Thrusters
            DrawThruster(_ship, _shipThrusterOffset_BottomRight);
            DrawThruster(_ship, _shipThrusterOffset_BottomLeft);
            DrawThruster(_ship, _shipThrusterOffset_TopRight);
            DrawThruster(_ship, _shipThrusterOffset_TopLeft);

            // Thrust Lines
            foreach (MyVector[] thrustPair in thrustLines)
            {
                MyVector thrustStart = _ship.Rotation.GetRotatedVector(thrustPair[0], true);
                thrustStart.Add(_ship.Position);

                MyVector thrustStop = thrustPair[1] * -20d;
                thrustStop.Add(thrustPair[0]);
                thrustStop = _ship.Rotation.GetRotatedVector(thrustStop, true);
                thrustStop.Add(_ship.Position);

                DrawVector(thrustStart, thrustStop, Color.Coral, 4);
            }

            BlitImage();

            #endregion
        }
Example #17
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            const double THRUSTERFORCE = 80;

            List <MyVector[]> thrustLines = new List <MyVector[]>();

            #region Physics

            _map.PrepareForNewTimerCycle();

            switch (_gravityMode)
            {
            case GravityMode.None:
                break;

            case GravityMode.Down:
                DoGravityDown();
                break;

            case GravityMode.EachOther:
                DoGravityEachOther();
                break;
            }

            if (_ship != null)
            {
                #region Ship Thrusters

                if (_isUpPressed)
                {
                    timer1_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_TopRight, new MyVector(0, 1, 0), THRUSTERFORCE);        // down
                    timer1_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_TopLeft, new MyVector(0, 1, 0), THRUSTERFORCE);         // s
                }

                if (_isWPressed)
                {
                    timer1_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_TopRight, new MyVector(0, 1, 0), THRUSTERFORCE * 10d);          // down
                    timer1_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_TopLeft, new MyVector(0, 1, 0), THRUSTERFORCE * 10d);           // s
                }

                if (_isDownPressed)
                {
                    timer1_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_BottomRight, new MyVector(0, -1, 0), THRUSTERFORCE);            // up
                    timer1_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_BottomLeft, new MyVector(0, -1, 0), THRUSTERFORCE);             // w
                }

                if (_isSPressed)
                {
                    timer1_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_BottomRight, new MyVector(0, -1, 0), THRUSTERFORCE * 10d);              // up
                    timer1_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_BottomLeft, new MyVector(0, -1, 0), THRUSTERFORCE * 10d);               // w
                }

                if (_isLeftPressed)
                {
                    timer1_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_BottomRight, new MyVector(0, -1, 0), THRUSTERFORCE);    // up
                    timer1_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_TopLeft, new MyVector(0, 1, 0), THRUSTERFORCE);         // s
                }

                if (_isRightPressed)
                {
                    timer1_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_TopRight, new MyVector(0, 1, 0), THRUSTERFORCE);                // down
                    timer1_TickSprtApplyThrust(thrustLines, _shipThrusterOffset_BottomLeft, new MyVector(0, -1, 0), THRUSTERFORCE);             // w
                }

                #endregion
            }

            DoVectorField();

            Collision[] collisions = _map.Timer(_elapsedTime);

            #endregion

            #region Draw

            // Turn the collision list into a list of tokens
            List <long> collisionTokens = GetCollisionTokens(collisions);

            pictureBox1.PrepareForNewDraw();

            #region Vector Field

            if (_vectorField.FieldMode != VectorField2DMode.None)
            {
                List <MyVector[]> drawLines, fieldLines;
                _vectorField.GetDrawLines(out drawLines, out fieldLines);

                foreach (MyVector[] drawLine in drawLines)
                {
                    pictureBox1.DrawLine(Color.DimGray, 1, drawLine[0], drawLine[1]);
                }

                foreach (MyVector[] fieldLine in fieldLines)
                {
                    pictureBox1.DrawArrow(Color.Chartreuse, 1, fieldLine[0], fieldLine[0] + fieldLine[1]);
                }
            }

            #endregion

            RadarBlip[] blips = _map.GetAllBlips();

            Brush brushBall       = new SolidBrush(Color.FromArgb(160, Color.Gold));
            Brush brushTorqueBall = new SolidBrush(Color.FromArgb(160, Color.RoyalBlue));
            Brush brushRed        = new SolidBrush(Color.FromArgb(160, Color.Tomato));

            Brush curBrush;

            for (int blipCntr = 0; blipCntr < blips.Length; blipCntr++)
            {
                if (blips[blipCntr].Sphere is RigidBody)
                {
                    #region Draw Rigid Body

                    DrawRigidBody(blips[blipCntr].Sphere as RigidBody, Color.MediumSlateBlue, Color.White, _drawCollisionsRed && collisionTokens.Contains(blips[blipCntr].Token));

                    #endregion
                }
                else if (_ship != null && blips[blipCntr].Token == _ship.Token)
                {
                    DrawShip(thrustLines);
                }
                else
                {
                    #region Draw Ball

                    bool isSolidBall = blips[blipCntr].Sphere is SolidBall;

                    // Fill the circle
                    if (_drawCollisionsRed && collisionTokens.Contains(blips[blipCntr].Token))
                    {
                        curBrush = brushRed;
                    }
                    else if (isSolidBall)
                    {
                        curBrush = brushTorqueBall;
                    }
                    else
                    {
                        curBrush = brushBall;
                    }

                    pictureBox1.FillCircle(curBrush, blips[blipCntr].Sphere.Position, blips[blipCntr].Sphere.Radius);

                    // Draw direction facing
                    if (isSolidBall)
                    {
                        MyVector dirFacing = blips[blipCntr].Sphere.DirectionFacing.Standard.Clone();
                        dirFacing.BecomeUnitVector();
                        dirFacing.Multiply(blips[blipCntr].Sphere.Radius);
                        dirFacing.Add(blips[blipCntr].Sphere.Position);

                        pictureBox1.DrawLine(Color.White, 2, blips[blipCntr].Sphere.Position, dirFacing);
                    }

                    // Draw an edge
                    pictureBox1.DrawCircle(Color.Black, 1d, blips[blipCntr].Sphere.Position, blips[blipCntr].Sphere.Radius);

                    #endregion
                }
            }

            brushBall.Dispose();
            brushTorqueBall.Dispose();
            brushRed.Dispose();

            pictureBox1.FinishedDrawing();

            #endregion
        }