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 Professional Discussion / Matrix, Indentation, and Problems

Author
Message
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 14th Mar 2010 20:19 Edited at: 14th Mar 2010 20:20
Hello

I visit these forums pretty much everyday, but I can never be motivated to code. Today I wrote a small program.

Firstly, as I've never coded in a while, I'm wondering whether the indentation of my code is correct.



Secondly, if you run that code (windowed), you should get a black margin between the taskbar and the actual program... or is that just me?

and Thirdly, how would I go about making my cube have collision with the matrix?

Windows 7 32-Bit Home Premium Intel Pentium Dual-Core @ 1.46Ghz 2038mb RAM
Kira Vakaan
17
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 14th Mar 2010 20:58
I think your indentation for blocks is fine, but code outside of a block like this:

probably shouldn't be indented. Of course, indentation in DBPro is irrelevant to how the code works, but the above just looks weird to me.

A few thoughts:
- If you want other people to run the code in windowed mode, you should probably insert a set window on command at the top of your code instead of hoping that their IDE settings are in windowed mode by default.
- For conditionals that protect only one statement, like:

try writing them like this:

- I don't have the command move camera up, so I couldn't really run the example exactly the way you intended. I'm not sure where it came from, but I'm assuming it's from IanM's utilities?

Hm, a black margin? I don't think I have that. The window just goes a bit behind the task bar for me.

As for collision with your matrix, I suggest checking out the command get ground height().

Hope that helps, and happy coding!
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 14th Mar 2010 21:16
Quote: "probably shouldn't be indented. Of course, indentation in DBPro is irrelevant to how the code works, but the above just looks weird to me."


Thanks, this was the bit that was confusing me the most, I didn't know whether it should just be a block or with indents.

Quote: "If you want other people to run the code in windowed mode, you should probably insert a set window on command at the top of your code instead of hoping that their IDE settings are in windowed mode by default."


Sorry, I didn't think of that I'll sort that out now

Quote: " For conditionals that protect only one statement, like:"


I don't like to code as such, partially because I like to write things in PHP from time to time, and it helps me to try and keep my coding style as similar as is possible.

Quote: "- I don't have the command move camera up, so I couldn't really run the example exactly the way you intended. I'm not sure where it came from, but I'm assuming it's from IanM's utilities?
"


Yeah, that's the one You should get the utilities, they can come in useful at times

Quote: "Hm, a black margin? I don't think I have that. The window just goes a bit behind the task bar for me."


I guess it must just be my resolution or something. Could it be because I'm running Windows 7? Then again, alot of us are running 7 now.

Quote: "As for collision with your matrix, I suggest checking out the command get ground height()."


Thanks I'll have a play with that now, thanks for the help, I appreciate it

Windows 7 32-Bit Home Premium Intel Pentium Dual-Core @ 1.46Ghz 2038mb RAM
janbo
17
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 14th Mar 2010 21:20
HI
I think u can't get the "collision" with the matrix,
but i think i know what u mean.

do thomthing like this

Kira Vakaan
17
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 14th Mar 2010 21:31
@Mad Nightmare:
Quote: "I don't like to code as such, partially because I like to write things in PHP from time to time, and it helps me to try and keep my coding style as similar as is possible."

Ah, gotcha.

Quote: "Yeah, that's the one You should get the utilities, they can come in useful at times"

I've been thinking about it, but I dunno. I like the idea of being able to write code and having just anyone be able to run it without having to say "You'll need this and this dll to compile". Just me, I guess.

Quote: "I guess it must just be my resolution or something. Could it be because I'm running Windows 7? Then again, alot of us are running 7 now."

I dunno. I'm still clinging onto XP for dear life. I think I might get the 64 bit version soon so I can hold on for a little longer.

Glad I could help
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 14th Mar 2010 21:36 Edited at: 15th Mar 2010 01:12
Quote: "I've been thinking about it, but I dunno. I like the idea of being able to write code and having just anyone be able to run it without having to say "You'll need this and this dll to compile". Just me, I guess. "


Most people have it anyways I think :p

Quote: "I dunno. I'm still clinging onto XP for dear life. I think I might get the 64 bit version soon so I can hold on for a little longer. "


You should upgrade to 7, it's really worth it, and much faster. Well, I came from vista, so it seems it to me.

UPDATE:

Okay I've applied most of the things, I've decided to keep my indentation though.

If you run this code, you will see that its not smooth at all, is there any way to set the object to the orientation of the matrix?



Thanks

Windows 7 32-Bit Home Premium Intel Pentium Dual-Core @ 1.46Ghz 2038mb RAM
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Mar 2010 18:15
Quote: "I'm wondering whether the indentation of my code is correct"


You might find this useful:

http://forum.thegamecreators.com/?m=forum_view&t=104344&b=5

Note: The V1.3 updated version is attached to one of the posts about half way down the page.

TDK

Login to post a reply

Server time is: 2026-07-26 23:41:09
Your offset time is: 2026-07-26 23:41:09