Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / I need a pause comand and a play again comand for my new program!

Author
Message
evil stuff
21
Years of Service
User Offline
Joined: 26th Sep 2003
Location:
Posted: 24th Dec 2003 07:21
Hi could you tell me the code to make the program pause while playing (like in games on ps2 and stuff) by pressing P and when you press it again the program will un-pause (this is in a do-loop so the thing can count your lives. could not find a different way.) and when you run out of lifes you press space or enter to boot the game again. this would be a great help for me!

may the code be with you
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 24th Dec 2003 09:12
Easiest way would be to create another loop inside your game loop. The pause loop is executed if the pause key is hit, and is broken when this key is hit:



Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 24th Dec 2003 09:51
What you would do instead of the wait command, is put in another loop, like:



The first loop simply makes the program pause while the spacekey is being pressed then it moves onto the second loop;
The second loop pauses untill the spacekey is pressed and then moves onto the third loop;
The third loop Pauses until the spacekey is released.

That way, you don't get that shocking jumping in and out of modes ( ie pausing ) when pressing the key...

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Hell IVIonkey
22
Years of Service
User Offline
Joined: 1st Apr 2003
Location: Outer Limits
Posted: 24th Dec 2003 10:12
evil stuff
21
Years of Service
User Offline
Joined: 26th Sep 2003
Location:
Posted: 24th Dec 2003 17:02
hey, should I put it in the main do-loop? because I have a nother loop inside of there, so will this effect the command? when I tried bothe of your ideas they didn't work.

may the code be with you
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 25th Dec 2003 04:02
It depends...

Show us your code, and we can tell you what to do...

Hope I Heleped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
evil stuff
21
Years of Service
User Offline
Joined: 26th Sep 2003
Location:
Posted: 25th Dec 2003 16:22
well, the program is a veriation to cave run in the fast track section. I have electronic darkbASIC (could not stand the amount of time pakeges from u.k. take.)I did this because I'm a beginner and I heard that doing this sort of thing was good to do. I also have the beginners guild to DB but it's not good enough, if you know what I'm saying. I don't think this is legal so i don't know if I should show you. but it's cool what I have done. soon I will make a web page for my games (I know some html and java script and I'm only 11! I learned html in fourth grade java script the next year.)

may the code be with you
ReD_eYe
22
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 25th Dec 2003 16:59
its perfectly legal to show us the code


GO TO THE ETERNAL DESTINY FORUMS!!! http://forums.eternaldestinyonline.com
Do it now!!!
evil stuff
21
Years of Service
User Offline
Joined: 26th Sep 2003
Location:
Posted: 26th Dec 2003 20:54
o.k.

may the code be with you
evil stuff
21
Years of Service
User Offline
Joined: 26th Sep 2003
Location:
Posted: 26th Dec 2003 20:56
press the source button to view the code Please I'm a beginner this is my first pride and joy so don't copy my IDEA!

may the code be with you
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 27th Dec 2003 03:28
Ok, a few things with your code;
When you put in Sync On, always put it at the very top of your program along with all the other loading things, like loading images, music, setting up arrays, loading dll's etc etc.

Then, once you've loaded everything, you put in the first commands that actually do stuff, for example, in your code, put in the Print commands after you have loaded everything...

I can also see that you haven't quite progressed onto Functions yet, so, where you have the main Do...Loop, take out the DO and replace it with a lable ie, "reset:" ( Without the inverted-comma's ) and take out the Loop and replace it with "Goto reset" ( Again, without the inverted-comma's ). What this does is basicaly the same as a Do..Loop ( For those of you that are into functions etc, yes, there are many ways that are better to do it than this, but it's his first program, give him a break ).

Also, where you have the Until command, you don't quite have it set up right. Where you have: "until get ground height(2,500+x,z) 10 then EXIT" it should be: "until get ground height(2,500+x,z) = 10" ( Again, without the inverted-comma's ).

Now, for the actuall problem that you required help with, the pause.
The code that I provided:

can go anywhere in your loop. Ie, anywhere between your Repeat..Until loop.

I suggest putting it with the other keyboard commands just to keep your code tidy.

Then, run your app, and hit space, and it should pause.

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 27th Dec 2003 03:32
Quote: "Without the inverted-comma's"

quotation marks? i guess quotes are differnt in some countries tho, arnt they?

Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 27th Dec 2003 04:38
yeah, same thing... It's an inverted ( ie, upside-down, or inside-out ) comma ( ie: , )...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
evil stuff
21
Years of Service
User Offline
Joined: 26th Sep 2003
Location:
Posted: 27th Dec 2003 19:11
hey thanks that worked so well! now I need to make the game start again when the player losses. I tryed a do-loop at the end but I noticed that the program was traped into a internal loop that was repeating itself instantly so it was impossible to press escape of the comand to restart the program (I had to cut the power from the computer.)

may the code be with you
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 29th Dec 2003 07:30
lol... I remember doing that too...

If that happens again, just hold down Alt and press F4, that will close the current window ( ie, the DB window ).

FOr the loseing part, when the condition is met for Game Over ( ie, lives = 0 ) just use "Goto reset" just the same as with when it breaks from the loop.

Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
JoelJ
21
Years of Service
User Offline
Joined: 8th Sep 2003
Location: UTAH
Posted: 29th Dec 2003 08:23
or press ctrl+alt+del at it will pop up the task manager.
or press f12 and it will break out of DB

Login to post a reply

Server time is: 2025-05-22 06:50:52
Your offset time is: 2025-05-22 06:50:52