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 / Understanding of code?

Author
Message
DJSTEVO
19
Years of Service
User Offline
Joined: 28th Dec 2004
Location:
Posted: 6th Jan 2005 01:28
In the Dark Basic Pro manual page 44 TUT7A.

Q - 1 Line 2 EneObj=11
I think i understand the EneObj but its what i think are called the parameters at the end =11?.I have loaded and changed this value but cannot see difference. Why is it 11 and why can i change this to what i think to any number

Q - 2 line 3 for ene=EneObj to EneObj+4
This line also appears in TUT7C?. Why is it duplicated twice and why is it neaded to?.

Q - 3 In the Dark Basic manual some code has capital letters but some do not. The code part not rem?.

Thanks.
ReD_eYe
21
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 6th Jan 2005 02:44 Edited at: 6th Jan 2005 02:46
Q-1

That line tells the program that the variable "EneObj" holds a value of "11". Variables are really useful and one of the first things you should learn about. In the case of that particular variable, i would assume it is the object number of an enemy object. Each object has an individual index number, that only it can have. If two objects have the same number, DB will give an error and quit. The reason for using a variable to hold an object number, is that it improves read-ability of your code.

is much easier to understand than

as you know which object you are referring to, rather than just a number.

Q-2

That ^ is the start of a "For - Next Loop" Its explained in the help files but it basically means that the variable ene is looped through the values of EneObj to EneObj+4. "For - Next Loops" are incredibly useful, so make sure you learn them.

Q-3
In dark basic, it doesn't matter wether you use capital letters or not, as code will work regardless. But it does make it easier to read, which is important.

is much easier to read than



Hope that helped.


http://www.dbspot.com/NYC
New years competition... Fo Shizzle.

Login to post a reply

Server time is: 2024-09-23 08:25:56
Your offset time is: 2024-09-23 08:25:56