This is a helicopter project. Very simple. A copter moves up if you hold the mouse button down. If not it keeps going down. An obstacle appears from the right and the task is to jump over it.
Snapshot:
Here is the source.
On request i am posting a crude algo of this program as i understand it...
display function has the following steps:
1) Check if the helicopter comes in contact with the wall. If so end the game and display appropriate message.
2) If wflag==1 that means start of the game so display messages indicating the way to start the game ie by clicking the mouse.
3) If its not start of the game and the game has not ended then in the second else part do the following
i) Increment the score and if the score overflows increment level
ii) Translate the helicopter by hm in the y direction and draw it.
iii) move the position of the wall to the left by bspd(block speed)... If it has already gone out of the window reinitialize its bx to 50 and by to any random value between 20-44.(width of the block is always 5 and height 35. So a block can range from 20 to 55 minimum to 44 to 79 maximum leaving 20-20 distance at the top and bottom)
iv) Draw the block at position bx,by by drawing a rectangle(red polygon)
Mouse function steps are:
1) If left mouse button is pressed or unpressed
i) if the left mouse button was pressed
initialize the idle function to moveHeliU
ii) if the left mouse button was unpressed
initialize the idle function to moveHeliD
Idle functions simply increment or decrement the hm value to move the helicopter up or down
Keyboard function can also be used to control the helicopter...
1) if 'w' key is pressed initialize the idle function to moveHeliU
2) if 'm' key is pressed initialize the idle function to moveHeliD
Init function
Initializes the window size by calling glOrtho with left=0,right=100,bottom=0,top=100
You might have guessed that moveHeliU and moveHeliD move the helicopter up and down respectively while also moving it to the right.
Snapshot:
Here is the source.
On request i am posting a crude algo of this program as i understand it...
display function has the following steps:
1) Check if the helicopter comes in contact with the wall. If so end the game and display appropriate message.
2) If wflag==1 that means start of the game so display messages indicating the way to start the game ie by clicking the mouse.
3) If its not start of the game and the game has not ended then in the second else part do the following
i) Increment the score and if the score overflows increment level
ii) Translate the helicopter by hm in the y direction and draw it.
iii) move the position of the wall to the left by bspd(block speed)... If it has already gone out of the window reinitialize its bx to 50 and by to any random value between 20-44.(width of the block is always 5 and height 35. So a block can range from 20 to 55 minimum to 44 to 79 maximum leaving 20-20 distance at the top and bottom)
iv) Draw the block at position bx,by by drawing a rectangle(red polygon)
Mouse function steps are:
1) If left mouse button is pressed or unpressed
i) if the left mouse button was pressed
initialize the idle function to moveHeliU
ii) if the left mouse button was unpressed
initialize the idle function to moveHeliD
Idle functions simply increment or decrement the hm value to move the helicopter up or down
Keyboard function can also be used to control the helicopter...
1) if 'w' key is pressed initialize the idle function to moveHeliU
2) if 'm' key is pressed initialize the idle function to moveHeliD
Init function
Initializes the window size by calling glOrtho with left=0,right=100,bottom=0,top=100
You might have guessed that moveHeliU and moveHeliD move the helicopter up and down respectively while also moving it to the right.
Can you please post the algorithm of the game!!
ReplyDeleteJust see if the algo i have posted meets the requirements...
DeleteCan you tell me how I can keep changing the background color after each level?
ReplyDeleteSend me source code
ReplyDeleteSudha.biradar001@gmail.com
Sir pls send me the source code for this project my email I'd
ReplyDeleteSudha.biradar001@gmail.com
Sir pls send full source code for this project my email I'd is
ReplyDeleteSudha.biradar001@gmail.com
Sir i got the source code and output also plz send me the detail explanation of the program to my email
ReplyDeleteSudha.biradar001@gmail.com
Sir can u please send me algorithm and flowchart to emailed: poojabr650@gmail.com
ReplyDeleteSir I have executed the code and it runs properly. Kindly send me the detailed explanation of the code
ReplyDeleteon which ide did u run the code
DeleteSir I have executed the code and it runs properly. Kindly send me the detailed explanation of the code to my mail:- divishathreddyadidala@gmail.com
ReplyDeletehave any source code for helicopter game in c++/oop
ReplyDeleteplz send it to me
Sir send me source code of this sir plz
ReplyDeleteSir source code
ReplyDeletenot so interface when open the game directly open heli game
ReplyDeleteyou can gave me source code, please ?
ReplyDeletemy email ducdinh16021999@gmail.com
Sir, I request you to please send me the source code of this game to my email asusdatta2135@gmail.com
ReplyDelete