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 / First complete game

Author
Message
Absolute Sandman
16
Years of Service
User Offline
Joined: 24th Mar 2009
Location:
Posted: 25th Mar 2009 06:23
Well, first of all this is my first post here so hello.

I have very little programming expirience so when I got Darkbasic I found this forum and read a lot of TDKs tuts so thanks to him for that, it helped a ton. Taking the advice on this forum I didnt start off huge and decided to do Hangman. It took my a long time with tons of trial and error but I finally got it done. Im sure my code structure and layout is an abomination and if you see anything wrong with it please tell me, especially how I can eliminate the two gotos that I use. So please tell me anything I have done wrong or anything that I can improve on it.



Again, I stumbled through this and sorry that I stopped using rem statements around half way through I started getting lazy. It isnt really a good game in the sense of fun, since there are only ten words and such but you can play it and see how it looks.
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 25th Mar 2009 12:01
Wow thats pretty good for a beginner. Good job and welcome!

For your gotos, a trick I learned from Ashinda is to use a single program loop and use subroutines to do stuff based off of a state variable like so:



Also, for your words, you could do something like this:



Note that for every line of DATA you will need a DATA statement.

But yeah, all in all, very good!

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Absolute Sandman
16
Years of Service
User Offline
Joined: 24th Mar 2009
Location:
Posted: 26th Mar 2009 03:12
Thanks for those examples. I had forgotten about data statements.


I will also put all the gosubs in the main loop like the first example, that will get rid of my gotos.
Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 26th Mar 2009 04:53
Nice(both of you lol)

New Site! Check it out \/

Login to post a reply

Server time is: 2025-05-17 00:44:25
Your offset time is: 2025-05-17 00:44:25