Computer Science Canada clear screen procedure in Turing for a game? |
Author: | neuro.akn [ Fri Dec 21, 2012 9:33 pm ] |
Post subject: | clear screen procedure in Turing for a game? |
Hello, I have a question regarding the cls procedure in Turing. How does one call a cls procedure so that at a random point (during a game) the screen will clear for a certain amount of time and display something else, and then return back to the game being played prior?? This would help a lot for my final. |
Author: | Metaxu [ Sat Dec 22, 2012 12:34 pm ] |
Post subject: | RE:clear screen procedure in Turing for a game? |
i assume you could make a procedure that you could call that would generate a random number. If this number = whatever then cls? After a delay of whatever you choose i guess you could just re implement what you had before. re draw everything and such. |
Author: | Raknarg [ Sat Dec 22, 2012 9:35 pm ] |
Post subject: | RE:clear screen procedure in Turing for a game? |
Are you trying to make a menu screen or something? |
Author: | neuro.akn [ Fri Jan 04, 2013 8:51 pm ] |
Post subject: | RE:clear screen procedure in Turing for a game? |
Well, I'm trying to call a procedure to clear the screen at a random point during the game. I have the menu, I have the game functionality, I just need to call a procedure to clear screen at random points (more than once) throughout the game... Any ideas? |
Author: | neuro.akn [ Fri Jan 04, 2013 8:53 pm ] |
Post subject: | RE:clear screen procedure in Turing for a game? |
The game is similar to the game "Copter" in which one must control a helicopter using the mouse to pass obstacles. |
Author: | Tony [ Sat Jan 05, 2013 12:41 am ] | ||
Post subject: | RE:clear screen procedure in Turing for a game? | ||
so your game loop should look something like
In the "draw world" step, you decide what should appear on the screen. cls could be that something. |
Author: | neuro.akn [ Sat Jan 05, 2013 5:34 pm ] |
Post subject: | RE:clear screen procedure in Turing for a game? |
I don't quite understand what you mean by this loop... I have the game and everything, and it works but what exactly do you mean with the "draw current world state" step? What would I write? |
Author: | Raknarg [ Sat Jan 05, 2013 6:01 pm ] |
Post subject: | RE:clear screen procedure in Turing for a game? |
Just draw everything out. You draw the map, any enemies out, the player, projectiles, obstacles, etc. Basically any drawing you have to do, you should do at the end. |
Author: | neuro.akn [ Sat Jan 05, 2013 6:46 pm ] |
Post subject: | RE:clear screen procedure in Turing for a game? |
I have everything drawn out and such, I just need to figure out how to call a cls procedure for clearing the screen at random points during gameplay |
Author: | evildaddy911 [ Sat Jan 05, 2013 9:05 pm ] | ||
Post subject: | RE:clear screen procedure in Turing for a game? | ||
What he means is during the "do stuff" part is determine if the cls command will be called, then using a conditional during the "draw" stage:
|
Author: | neuro.akn [ Sun Jan 06, 2013 12:14 am ] |
Post subject: | RE:clear screen procedure in Turing for a game? |
Okay, thank you!! But must I declare "clear, DoStuff, and DrawGame?" or are they predefined? And to clarify, this will randomly clear the screen at a random point? Lastly, say I want to clear the screen and then a question will pop up on the new cleared screen for the user to answer... If the user answers correctly, they get to return to the game. How would I do that? |
Author: | evildaddy911 [ Sun Jan 06, 2013 10:31 am ] | ||
Post subject: | Re: clear screen procedure in Turing for a game? | ||
this is not actual code for a game. this is simply just an explanation of what Tony and Raknarg were suggesting. "clear," "DoStuff," and "DrawGame" are not predefined, you would have to define them yourself. The question popup would similarly be included in the do/draw stuff sections:
remember: these are basic guidelines for how to solve this type of problem, some models may be better for this situation. do not copy and paste the code |
Author: | neuro.akn [ Mon Jan 07, 2013 12:01 pm ] |
Post subject: | RE:clear screen procedure in Turing for a game? |
Ok, great. This should help a lot. Thank you! |
Author: | neuro.akn [ Fri Jan 11, 2013 1:46 pm ] |
Post subject: | RE:clear screen procedure in Turing for a game? |
Given my code, these guidelines for "DoStuff," "DrawGame," etc. will not work. I tried calling them and there was a lot of errors, Upon correcting these errors, the game did not run properly, and it basically messed up the entire program. However, I rearranged everything and got my original code in order. Is there any other way that I can create a procedure to clear the screen after a certain amount of time (using a timer)? |
Author: | Tony [ Fri Jan 11, 2013 4:02 pm ] |
Post subject: | Re: RE:clear screen procedure in Turing for a game? |
If you don't have a single spot in the code where you can say "for this turn of the game, I have not yet drawn anything, but I'm about to start" and another single spot where you can say "I have finished drawing everything for this turn and am ready to push it to screen", then you are working with a very complicated design. neuro.akn @ Fri Jan 11, 2013 1:46 pm wrote: Is there any other way that I can create a procedure to clear the screen after a certain amount of time (using a timer)?
In short, no. You could have a timer run some code, but what will end up happening is that as your timer is clearing the screen, the game is still drawing to the screen. The net effect will be that only parts of the game will appear. Your next question will be "my game is flashing like crazy, how do I fix it?" and the response will be just what we said above -- go with a simple game-loop design. |
Author: | neuro.akn [ Sun Jan 13, 2013 2:22 pm ] |
Post subject: | RE:clear screen procedure in Turing for a game? |
Hmm, okay. I tried the game-loop design but it got even more complicated and disorganized all of my code. I'll see what I can do. Thanks! |
Author: | Insectoid [ Sun Jan 13, 2013 2:25 pm ] |
Post subject: | RE:clear screen procedure in Turing for a game? |
In the future, you should use the game loop right from the beginning. It will actually make your code far easier to read and write and ultimately less complicated and more organized. It's only becoming complicated and disorganized now because you're trying to force existing code into the game loop format, which doesn't really work that well. |
Author: | neuro.akn [ Sun Jan 13, 2013 2:34 pm ] |
Post subject: | RE:clear screen procedure in Turing for a game? |
Oh, I see. Yeah; I will definitely start off with the game-loop design next time. |