// File: lunar.cxx // Written by Michael Main, Sep 15, 2005 // This is a demonstration game. The user tries to land a lunar lander. #include // Provides bgi graphics #include // Provides cout using namespace std; // Physical constants const double FORCE_MAIN_THRUSTER = 3000; // kg m/s^2 const double FORCE_SIDE_THRUSTER = 30; // kg m/s^2 const double GRAVITY = -9.8/6; // m/s^2 const double MASS_LANDER = 1000; // kg const double STARTING_FUEL = 250; // kg const int DELAY = 10; // ms const double DELTA_T = DELAY/1000.0; // s // Graphical constants const int WINDOW_WIDTH = 851; const int WINDOW_HEIGHT = 608; const int GROUND_ZERO_Y = 566; const int ROCKET_WIDTH = 86; const int ROCKET_HEIGHT = 113; const int BACKGROUND_BYTES = 2069656; const int ROCKET_BYTES = 38896; // Function prototypes //The main program int main( ) { bool main = false, left = false, right = false; // Are the thrusters on? double x, y; // Position (m) double fuel; // Remaining fuel (kg) double vx, vy; // Velocity (m/s) double vr; // Rotational radians/sec double r; // Rotational pos radians double t; // Time since start initwindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Mario", 0, 0, true); do { // Adjust the control variables // Adjust the physical variables t += DELTA_T; // Redraw the screen and delay delay(DELAY); } while(true); return 0; }