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 Professional Discussion / game end play it again????

Author
Message
sadsack
22
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 1st Feb 2011 22:58
Hello all,
I got my parachute game done, working fine. I am just adding a few thinks now. What I am having a problem with is the game is over and I want to be able to play it again. I have tryed a few thinks and none worked very well. Can some on tell the best was of going about doing this.
Thank You
renny

Life is not fair, so deal with it.
http://www.gusroundtable.com/
kamac
15
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 1st Feb 2011 23:04
Em, make something like

start:

on the just beggining of the code, and when you want to start it again use: gosub start

In progress of making Archery Simulator... Or maybe not simulator x]?

@There'll be a sig @
The Wilderbeast
20
Years of Service
User Offline
Joined: 14th Nov 2005
Location: UK
Posted: 1st Feb 2011 23:27
Just make sure that you reset any variables that you're using.

Yodaman Jer
User Banned
Posted: 1st Feb 2011 23:33
Also be sure to delete ALL of your game objects, images, sounds and textures so that when you use "gosub start", you won't get an "object/image/sound already exists" error. Good luck!

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Feb 2011 13:15 Edited at: 2nd Feb 2011 13:17
Quote: "Also be sure to delete ALL of your game objects, images, sounds and textures so that when you use "gosub start", you won't get an "object/image/sound already exists" error. Good luck!"

Or put "start:" after your object/image/sound loading code

EDIT:
Normally I put all my setup stuff in a sub-routine called "setup:" and call it once before the game loop, that way I can run my game as many times as I like without having to re-load.

sadsack
22
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 2nd Feb 2011 16:47
Thanks,
I will try all of it and see what works the best.
renny

Life is not fair, so deal with it.
http://www.gusroundtable.com/
Yodaman Jer
User Banned
Posted: 2nd Feb 2011 18:19 Edited at: 2nd Feb 2011 18:20
Quote: "Or put "start:" after your object/image/sound loading code"


Oh my God. In my three years of programming with DarkBASIC, I've never thought of doing it that way. Guess ya' learn something new everyday!

Heh, and I'm trying to start a DBP resource blog too...maybe I shouldn't.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Feb 2011 18:28
Quote: "Oh my God. In my three years of programming with DarkBASIC, I've never thought of doing it that way. Guess ya' learn something new everyday!"

I seem to learn something every time I look at a new post!

One further point is that if you run your game fullscreen exclusive and the game looses focus for some reason you'll have to reload your media. Using a setup sub-routine you can just call it once the game gets focus back.

IanM's matrix utility plugin has a function called "has focus()" (or something similar) that you can use to check your game "has focus"...

sadsack
22
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 2nd Feb 2011 23:14
Here the code I used. I hope that may help some one.
renny



Life is not fair, so deal with it.
http://www.gusroundtable.com/

Login to post a reply

Server time is: 2026-07-18 05:06:24
Your offset time is: 2026-07-18 05:06:24