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 / Help Me With Game

Author
Message
Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 14th Aug 2005 03:08 Edited at: 14th Aug 2005 03:09
Ok Heres The Code


Well The Problem Is That It supposed to goto start when u press enter but it just keeps going to that automaticcaly without enter y?


My Website With Some Of My Games: www.freewebs.com/actiongamestudios
Killonyas Slayer
19
Years of Service
User Offline
Joined: 13th Apr 2005
Location: Mozerok,Eartreg
Posted: 14th Aug 2005 03:19
Darkbasic ignores labels, it'll go right past them.

If you run a program in step though mode, once you get to an if/then, and the condition is not met, the game will just skip the 'then'.

so, try using



This way, it will keep going(doing nothing) until you press enter, then it will jump to 'start'.

-"I'm over twice as strong as I was when we last met"-
-"Good, Twice the fall, double the glory"-
Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 14th Aug 2005 03:30
Thank You So Much Time Splitter i gettin so frustrated at that.



My Website With Some Of My Games: www.freewebs.com/actiongamestudios
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Aug 2005 04:20
Or even just add the line:

Wait Key

where you have "If ReturnKey() = 1 then Goto Start".



TDK_Man
Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 14th Aug 2005 04:22
Omg oh yeah tdk no brainer lol
thanks


My Website With Some Of My Games: www.freewebs.com/actiongamestudios
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 14th Aug 2005 04:59
I suggest you get rid of the "Loading...". You want people to get into the game asap.

If you use "suspend for key" it'll wait till any key is hit. Then right after the suspend have "goto Start".
Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 14th Aug 2005 06:42
o Okay


My Website With Some Of My Games: www.freewebs.com/actiongamestudios
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Aug 2005 06:48
There's actually no need to use Goto anywhere, anytime... ever!

It's bad practice to use it these days with all the methods of code structuring available.

It's a throwback to the days when you hadn't got all the loops, Gosub..Return and Functions that you have today. I don't really know why it's left in - other than compatibility.

There's no difference between Wait Key and Suspend For Key apart from one takes longer to type than the other.

And putting a Goto Start on the next line is redundant as without it, the next program line to be executed is going to be the Start: label line anyway.

So, scrap both your Goto's and if you like, both the labels too - they aren't needed.

I would only leave the labels in myself because the IDE displays labels and their line numbers - so in large programs it's easier to scoot around to different sections.

TDK_Man
Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 14th Aug 2005 06:59
Oh Okay So You Are Saying Take Out Labels?


My Website With Some Of My Games: www.freewebs.com/actiongamestudios
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Aug 2005 07:18
In the code snippet you posted above, I'm just saying that they serve no purpose. They don't actually do anything.

You can leave them in if you like - to use as simple labels which DB ignores, but in large programs simply mark out sections which you can locate quickly. That's all I use them for.

In small programs (less than a thousand or so lines), it's not that important. They certainly aren't *needed*.

If you are putting them in just to be the targets for Goto jumps then don't - there are always alternatives to using Goto.

TDK_Man
Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 14th Aug 2005 08:48
Ah Thanks Tdk. Always There To Help


My Website With Some Of My Games: www.freewebs.com/actiongamestudios
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 14th Aug 2005 11:15
Quote: "There's no difference between Wait Key and Suspend For Key apart from one takes longer to type than the other."


I love typing. You're right about the goto statement... it's easy to write code without gosub too.
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Aug 2005 19:03
Quote: "I love typing."


I don't!

I don't know what I'd do if Ctrl-C and Ctrl-V didn't exist...

TDK_Man
Cameron
19
Years of Service
User Offline
Joined: 7th Aug 2005
Location: In Your Closet...
Posted: 14th Aug 2005 19:07
hahhahahah lol yeah seriously



"Computers Are Not Smart. They Just Do What You Tell Them To."
Milky the purple crab
19
Years of Service
User Offline
Joined: 5th Aug 2005
Location:
Posted: 17th Aug 2005 12:25
hey, this might be off topic but i don't understand the gosub command.

can someone tell me please?

I don't fear pain.....I fear feeling it.
Me!
19
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 17th Aug 2005 15:13
Milky TPC, could you start a new thread asking about gosub please, people use the search to find subjects (and may want to ask about gosub) and they can`t find a reply buried down in this thread, if you make a new one titled "could you explain gosub please" then you will get lots of replys and people can find it in the search when they want to ask about gosub, thanks.

Login to post a reply

Server time is: 2024-11-27 20:30:39
Your offset time is: 2024-11-27 20:30:39