Click here to Skip to main content
15,889,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
okay so im making a 2D bomb drop game with C++
i would like to remove "KABOOM!" after 40 milliseconds.
this is my code:
https://gyazo.com/8fbc8a54ae6d733d070c0197abf1de61[^] https://gyazo.com/7d6cdc1fab4899d4785df02b81f75c1b[^] how do i remove "kaboom!" after that delay?

What I have tried:

i really dont know any solutions
Posted
Updated 7-Oct-16 1:51am
v2

C++
if (bomy > 46){
  gotoxy(playerx, 47);
  printf("Kaboom!");
  delay(40);
  gotoxy(playerx, 47);
  printf("       ");
}
 
Share this answer
 
Comments
Richard MacCutchan 7-Oct-16 8:49am    
Ah, the good old days of the 1980s.
CPallini 7-Oct-16 10:28am    
Exactly! :-)
We can't say: it's going to depend on the system you are using. There is nothing "built in" to printf or general purpose C libraries which allow you to clear text you have printed (because the general purpose stuff comes from the days of paper rolls, raster and vector VDUs, etc., and there was no "one way" to do it on every device).

Check your system libraries for an appropriate "clear screen" or similar function.
 
Share this answer
 
v2
Comments
Jasper Bakker 7-Oct-16 7:24am    
well printf is an build in function do you need m includes to tell me how or not.
i have found a different C++ file with different function. one of these functions contains clrscr(); (clearscreen) but if i use that in the IF function even my plane will disapear, do you have a different C++ file with a function that can delete text? and not the whole screen (sorry im a beginner ^^)
Afzaal Ahmad Zeeshan 7-Oct-16 9:07am    
If you are doing this on the entire screen of the terminal, then you require to remove everything from the screen and re-print everything based on the logic and state of the program.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900