read and you'll know

guys im making a kind of game
ill show you how it looks like in my imaginations :-


*/ INTERFACE /*
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
       |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|       
       |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
       |_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|_|
       |                                           |
       |                                           |
       |                                           |
       |                                           |
       |                                           |
       |                                           |
       |                                           |
       |                                           |
       |                                           |
       |                    O                      |                            
       |                  =====                    |
       |___________________________________________|



HERE IS WHAT I WANT
# I WANT TO MOVE THE BALL DIAGONALLY AND REFLECT ON TOUCHING THE WALLS OR THE BLOCKS.
# AIM IS TO MAKE THE BALL STRIKE ON A BOX AND COLLECT POINTS.
# THE ABOVE THINGS ARE EASY TO MAKE BUT,
I COULD NOT CREATE A FUNCTION THAT CAN MOVE THE BALL WITH OUT LOSING THE CONTROL FROM USER ,THAT IS USER MUST BE ABLE TO MOVE THE BAR (======) TO THE LEFT AND RIGHT WHENEVER HE WANTS

I NEED AN IDEA QUICKLY , THANKS GUYS!
I NEED AN IDEA QUICKLY , THANKS GUYS!
No need to shout. What you need is well known and widely used. It is called "Game Loop": http://gameprogrammingpatterns.com/game-loop.html

Also you would need non-blocking input, which standard C++ does not provide. You should search for your OS specific functions or get a library which does it for you.
Last edited on
@ MiINipaa ,


sorry for being a bit rude there , i lost my patience when i could not find a solution .
thanks for game loop ill try it !
Do you know which library you are going to use for this yet OP? You could technically do this with the standard library but I really would NOT recommend it. You'll spend twice as long creating and inferior product. I usually suggest SFML to people since that is the one that I am most familiar with. But SDL and Allegro are two more good choices with a decent sized following among our contributing members.

@ Computergeek01,

thanks but i prefer using kbhit();kbhit(); function
to get a key from buffer and thanks 4 game loop
Topic archived. No new replies allowed.