Link to home
Start Free TrialLog in
Avatar of CahitEy
CahitEy

asked on

Homework* Creating an moving 2D airplane using OpenGL - C++ please help URGENT !

Using OpenGL environment you are asked to create an airplane and move it around the screen.

Step 1: Define the shape of a 2D aircraft. You can draw a simple aircraft model as any sort of polygon.

Step 2: Make sure you can draw the airplane by calling a drawing function
Void draw_airplane(int xpos, int ypos, angle, warpfactor)                  
This function will draw the airplane at a position P= (xpos, ypos). The angle and warfpfactor will be explained in Step3 and Step 5 respectively. Make sure that the airplane does not crash when the airplane is close the screen border.

 Step 3: The rotation angle is defined by the angle . The rotation angle initially starts with a value of 0, which should make the direction of the airplane to the right of the screen. Use left and right arrow keys on the keyboard to rotate the airplane into left and right directions respectively.

Step 4: Each time the main loop of the program is executed, the airplane will have a position P and a velocity V.  Velocity of an object is defined by its speed and direction. Each time through the loop, the new position is obtained by adding the velocity vector to the position vector to get a new position for the airplane.
When the airplane gets near the edge of the screen it is moved to the opposite edge of the screen so that it goes off one edge onto another.

Step 5 (Optional, 20 points bonus). Choose a new key to control the velocity. When the key is hit, add a unit vector to the current velocity vector (in the same direction) that is
 
Assume that the airplane has a flexible hull, and when then thrusters is turned on, the airplane compresses in the direction with the angle . Make a variable C that defines the degree of compression of the airplane and make C larger when thrusting is used. Let C slowly return to its default value (no compression) when thrusting is not being used. In the draw airplane function, C should be passed in as the warp factor, and it should cause a scaling of the ship in the direction it is facing when the thrust is applied.
Avatar of CahitEy
CahitEy

ASKER

Is anybody writing a code for me?
Avatar of Zoppo
Hi CahitEy,

no, sorry, no one will write the code for you.

It is agains EE rules to do your homework for you. You can always ask about specific problems when trying to solve it.  Asking for a
solution however is out of question.

https://www.experts-exchange.com/help.jsp?hi=21

You should ask EE to delete this question (via the link 'Request Attention' above), then try to solve your problem yourself and ask specific question if you get stuck with any particular problem.

ZOPPO
ASKER CERTIFIED SOLUTION
Avatar of George Tokas
George Tokas
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Using OpenGL environment you are asked to create an airplane and move it around the
screen.
Step 1: Define the shape of a 2D aircraft. You can draw a simple aircraft model as any sort
of polygon.
Step 2: Make sure you can draw the airplane by calling a drawing function
Void draw_airplane(int xpos, int ypos, angle, warpfactor)
This function will draw the airplane at a position P= (xpos, ypos). The angle and warpfactor
will be explained in Step3 and Step 5 respectively. Make sure that the airplane does not crash
when the airplane is close the screen border.
Step 3: The rotation angle is defined by the angle¿ . The rotation angle initially starts
with a value of 0, which should make the direction of the airplane to the right of the screen.
Use left and right arrow keys on the keyboard to rotate the airplane into left and right
directions respectively.
Step 4: Each time the main loop of the program is executed, the airplane will have a
position P and a velocity V. Velocity of an object is defined by its speed and direction. Each
time through the loop, the new position is obtained by adding the velocity vector to the
position vector to get a new position for the airplane.
When the airplane gets near the edge of the screen it is moved to the opposite edge of the
screen so that it goes off one edge onto another.
Step 5 (Optional, 20 points bonus). Choose a new key to control the velocity. When the
key is hit, add a unit vector to the current velocity vector (in the same direction) that is
Vnew ¿V ¿ (Cos¿, sin¿)
Assume that the airplane has a flexible hull, and when the thrusters is turned on, the
airplane compresses in the direction with the angle¿ . Make a variable C that defines the
degree of compression of the airplane and make C larger when thrusting is used. Let C slowly
return to its default value (no compression) when thrusting is not being used. In the draw
airplane function, C should be passed in as the warp factor, and it should cause a scaling
of the ship in the direction it is facing when the thrust is applied.
not nice