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.

Newcomers DBPro Corner / My first DB code. Ever!

Author
Message
MenTalTerYn
14
Years of Service
User Offline
Joined: 27th Dec 2009
Location: In my chair
Posted: 28th Dec 2009 03:15
Hi, I'm brand spankin' new to the DarkBASIC scene. My only actual previous coding experience would be some minor html work, but nothing major. Today that changes though! I started dabbling with DarkBASIC and made my first piece of working code. Nothing special, just a little For/Next Loop test, just to see if I could figure it out.

That's it... just happy I figured somethin' out by myself for once XD

Kira Vakaan
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 28th Dec 2009 06:04
Congratulations! And welcome to the forums.

A nice first program. Everyone's gotta start somewhere.

I see you've defined labels Start and Finish. Be careful with that, as using the goto command is widely considered bad programming practice. The idea is that you should be able to control the flow of the program without the use of such blatant and explicit jumps. In fact, in the Python language, goto and labels don't even exist. As a note to the other forum members: I am in no way attempting, and have no desire to spark a ridiculous goto discussion.

At any rate, you're off to a good start. Where to now?
Mew151
16
Years of Service
User Offline
Joined: 1st Jun 2008
Location: Glitch city
Posted: 28th Dec 2009 06:27
Try making a simple game like a number guessing game.

I modified one until it became impossible.

Mulderman
20
Years of Service
User Offline
Joined: 8th Jan 2004
Location: C:\\
Posted: 28th Dec 2009 06:40
Another beginner mistake, using goto's.



Get rid of GOTO's.
That's second thing you must do with this code.

New GTA2 Map Editor :: http://www.gta2madness.co.cc
MenTalTerYn
14
Years of Service
User Offline
Joined: 27th Dec 2009
Location: In my chair
Posted: 28th Dec 2009 22:31
First let me start off by saying thanks for the response. I learned shortly after posting that bit of code about how goto's are bad, though I'm still trying to figure out an alternative (still reading guides/tutorials). I'm thinkin' subroutines would do the trick, will have to toy with it later.

As for what i'm doing now, well... I dont quite know. A number guessing game seems like a good start, then I'll try my hand at a pong clone or (if i'm feeling daring) maybe a galaga clone.

Anyways, Thanks for the welcome and I'll be sure to remove those nasty goto's.

BTW, this is how my loop test turned out before I stopped toying with it (and before learning about goto's)
Kira Vakaan
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 29th Dec 2009 02:54
Yes, you could use subroutines to do the trick, or you could just use conditional blocks like so:


Also, you can test both letter cases by just making sure the user entered string is in one case or the other.



Hm, I'd say take on galaga. Just make sure you have a solid idea of every aspect of the game before you start coding.
MenTalTerYn
14
Years of Service
User Offline
Joined: 27th Dec 2009
Location: In my chair
Posted: 30th Dec 2009 14:16
Ah, thanks Kira! Seems I still have a lot more reading to do before I attempt anything major (Didn't even know about the conditionals). Oh well, I only made that loop test just to see if I understood the concept of loops. After toying with it though, and posting here, I ended up learning more than I expected. Thanks for all the help

Login to post a reply

Server time is: 2024-09-28 14:20:08
Your offset time is: 2024-09-28 14:20:08