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 / Sync problem I think. Please help!

Author
Message
Flamertor
8
Years of Service
User Offline
Joined: 12th Oct 2011
Location:
Posted: 1st Jan 2012 19:52
I made a menu for my game and then added the code to my menu and now they don't work. I don't know why but can someone help me please. It's at the loading screen becuase the bitmap says there and you die for no reason. Thxs in advance.

LBFN
13
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 2nd Jan 2012 03:01
Not to be harsh, but this is a prime example of why using the GOTO command is frowned upon by many programmers (FYI: I am not interested in a GOTO / NO GOTO debate with other programmers on this forum). You are jumping all over the place and it makes your code difficult to debug; not only for yourself, but for others who are interested in helping you. I would suggest that you restructure the program so that you have no need for the GOTO command at all. Who knows, your problem might just get solved by doing that.

So many games to code.......so little time.

Flamertor
8
Years of Service
User Offline
Joined: 12th Oct 2011
Location:
Posted: 2nd Jan 2012 14:10
Im not good at not using it and all the goto's are just above the actual game. I also now it is't the goto and gosub becuase they are in my other menu alot more. Thxs for te help (I do acuarly mean it) Soz about the spelling. Can you show me a way to code without goto and gosubs.
LBFN
13
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 2nd Jan 2012 16:47 Edited at: 3rd Jan 2012 02:42
Quote: "Can you show me a way to code without goto and gosubs."


Yes, I will take a look at your code and see if I can re-organize it so that the GOTOs are gone. Gosubs are fine and can be used to write structured code. In your other thread, Latch showed you how to include subroutines (i.e. gosub / return) in your code properly.

One thing I noticed right off, is that you are loading images on the fly. It would be better to load all of the images you need (a LoadImages subroutine would be a good idea) and paste them as needed. You can even give the variables for the images names so that it makes sense.

I plan to get back as soon as I can, but realistically, it will take a little time to get the code restructured.

EDIT:
Alright, I have made some major edits to your game code. Please bear in mind that I have not run this to make sure everything checks out, as I do not have the media for it. So, you may have to tweak some things. If for some reason it won't run and you can't figure it out, you can email me your media and I will debug it for you.

Also, my main focus here was to show you how to incorporate subroutines and structure your code better. You could put all of the images loaded into the LoadImages subroutine, for example. You could write a separate subroutine to load the sounds.

Please note: I have setup your Settings subroutine in such a way that it should let the user pick their screen resolution on the fly. Changing the display mode normally is one of the first things done in a program, as it can cause problems if you do it later on. Therefore, the program never executes the Settings subroutine. It is up to you to incorporate it.



So many games to code.......so little time.

Flamertor
8
Years of Service
User Offline
Joined: 12th Oct 2011
Location:
Posted: 3rd Jan 2012 09:48
Thx for the reponse. Not really with it today will try tommoro. I'll try tommoro
Flamertor
8
Years of Service
User Offline
Joined: 12th Oct 2011
Location:
Posted: 4th Jan 2012 16:58
I found what the problem is, but I don't know how to fix it . It's the map and the game not loading, there nothing behind the menu and i don't know why. The Game is in the goto Game about half way down.
LBFN
13
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 4th Jan 2012 18:47
Quote: "The Game is in the goto Game about half way down."


goto Game? There is no 'goto Game' in the code that I submitted for your consideration. In other words, I have completely wasted my time trying to help you write structured code........

So many games to code.......so little time.

Flamertor
8
Years of Service
User Offline
Joined: 12th Oct 2011
Location:
Posted: 5th Jan 2012 20:34
no it didn't work becuase of some commands and the reason i got the goto is to make my menu appear. Soz when i looked at it as well i was shattered and falling alseep plus i had school the next day.
Latch
14
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 16th Jan 2012 20:48
Quote: "no it didn't work becuase of some commands and the reason i got the goto is to make my menu appear"

@Flamertor

I think you may find the answers you need if you do spend some time looking at the code LBFN restructured for you at your request:

from Flamertor:
Quote: "Thxs for te help (I do acuarly mean it) Soz about the spelling. Can you show me a way to code without goto and gosubs. "


It can be difficult to write programs, but it can get more difficult if one falls into bad habbits. Debugging is one of the least fun things to do, but if you structure your code well, it can be a much easier task. Again, I recommend you take a look at what LBFN did, look at your own code, and try and see what needs tweaking. I'm willing to bet if you ask direct questions about what LBFN did based on the code, he will help you out.

Enjoy your day.
Flamertor
8
Years of Service
User Offline
Joined: 12th Oct 2011
Location:
Posted: 19th Jan 2012 18:13
I have broke that bad habit in my lastest game developments. Really I have!
Flamertor
8
Years of Service
User Offline
Joined: 12th Oct 2011
Location:
Posted: 25th Feb 2012 13:24
why did you post that

Go to my website http://imthegamerunner.moonfruit.com
BN2 Productions
16
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 26th Feb 2012 01:09
He's a bot, don't know how it got around post approval though...

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Flamertor
8
Years of Service
User Offline
Joined: 12th Oct 2011
Location:
Posted: 26th Feb 2012 09:31
ah thank you for telling me

Go to my website http://imthegamerunner.moonfruit.com

Login to post a reply

Server time is: 2020-08-15 11:39:56
Your offset time is: 2020-08-15 11:39:56