/// <summary> /// Thrust the engines /// </summary> private void Thrust(double totalSeconds) { if (Fuel < 0) { return; } //lander rotation //add thrust sY -= Math.Sin(ConvertAngle.NormalizeAngle(Rotation + Math.PI / 2)) * totalSeconds * ThrustSpeed; Console.WriteLine(sY); sX -= Math.Cos(ConvertAngle.NormalizeAngle(Rotation + Math.PI / 2)) * totalSeconds * ThrustSpeed; //decrease fuel Fuel--; }
public Bitmap Draw() { using (Graphics g = Graphics.FromImage(bmp)) { g.Clear(Color.Black); //draw the ground for (int i = 0; i < terrain.points.Count - 1; i++) { g.DrawLine((terrain.points[i].Y == terrain.points[i + 1].Y) ? landingPen : whitePen, terrain.points[i], terrain.points[i + 1]); } //transform graphics object by the rotation Matrix m = new Matrix(); m.RotateAt((float)ConvertAngle.RadiansToDegrees(Module.Rotation), Module.Location); g.Transform = m; g.DrawImage(Module.Sprite, Module.LocationGraphics); //restore transformation m.Reset(); g.Transform = m; //draw stats const int posStatX = 0; g.DrawString(DateTime.Now.ToLongTimeString(), statsFont, Brushes.White, (bmp.Width) / 2, 0); g.DrawString("Fuel: " + Module.Fuel, statsFont, Brushes.White, posStatX, 0); g.DrawString(string.Format("Lander: x={0:0.00} y={1:0.00}", Module.X, Module.Y, ConvertAngle.RadiansToDegrees(Module.Rotation)), statsFont, Brushes.White, posStatX, 30); g.DrawString(string.Format("Speed: x={0:0.00} y={1:0.00}", Module.sX, Module.sY, 0), statsFont, Brushes.White, posStatX, 60); g.DrawString("Score: " + newPlayer.getScore().ToString(), statsFont, Brushes.White, 1000, 10); if (Paused) //or game over { g.DrawString(Reason.ToString(), new Font(statsFont, FontStyle.Bold), Brushes.White, (bmp.Width) / 2, (bmp.Height) / 2 - 200); } } return(bmp); }