I made something like a game, you move your character(black box) up and down and there is a wall with some blank in middle of it, that wall is at right side, its coming from right to left side and if you touch the wall game ends.
I get keypresses in a while loop like;
while(keyboardInput=getKeyPress()){
switch(keyboardInput){/*checks the key and goes up or down*/}
//draws the main character, then also draws the wall.
}
and I made a wall() function, it prints blocks to make a wall.
Problem is, the wall moves only after getting a keypress, my keypress function works with _getch()
The thing I want to see is, that wall will always move like every one second to left side even if user doesn't press any key, and key press/movement will work the same way.
I put wall() function into the wall() function. It prints it just like I want but I cant get any keypress because that wall() loops forever.
Game looks like this:
*
*
*
*
*
■
*
*
*
*
*
I am waiting for your answers, thank you!