- #1
jasonsmith206
- 10
- 0
Hey everyone!
This is my own personal project that I'm trying to get right but i ran into a bit of a problem.
Here's the idea:
I want to make a text based game where the player inputs data such as choices or numbers reflected what's asked of them from the program. The below program is "suppose to" be were a player trips a bomb and it counts down from 60 to 0 and the player has that many seconds to input a 3 digit code before the timer reaches zero.
My question is how can i get it to count down and still get the user to scanf their input and then stop the timer if they're right
This code is part of a bigger project so let's just say for sake of argument the player already knows the digits to disarm the bomb so
armNum1=1;
armNum2=2;
armNum3=3;
thank you for any help or suggestions to make this better!
This is my own personal project that I'm trying to get right but i ran into a bit of a problem.
Here's the idea:
I want to make a text based game where the player inputs data such as choices or numbers reflected what's asked of them from the program. The below program is "suppose to" be were a player trips a bomb and it counts down from 60 to 0 and the player has that many seconds to input a 3 digit code before the timer reaches zero.
My question is how can i get it to count down and still get the user to scanf their input and then stop the timer if they're right
This code is part of a bigger project so let's just say for sake of argument the player already knows the digits to disarm the bomb so
armNum1=1;
armNum2=2;
armNum3=3;
Code:
void RoomTwo(void){
int Bcounter=60;
int playerNum1,playerNum2,playerNum3;
int armNum,armNum2,armNum3;
printf("-----------------------------------------------------------------\n\n");
printf(">>Oh no you tripped a bomb!\n\n");
printf(">>A small screen reads \"You have 60 seconds to enter a three digit code to disarm\"\n");
printf("Hurry, enter the numbers");
do{
while(Bcounter!=0){
printf("\b\b%d", Bcounter);
Bcounter--;
Sleep(1000);
}printf("\n BOOM!");
YourDead();
}while(playerNum1!=armNum&&playerNum2!=armNum2&&playerNum3!=armNum3);
printf("Phew! that was close!");return 0;
thank you for any help or suggestions to make this better!