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 / need MAJOR help (on a small scale) with my code, somewhere.

Author
Message
Enigma
17
Years of Service
User Offline
Joined: 11th Dec 2007
Location: In your closet
Posted: 6th Mar 2008 23:12 Edited at: 6th Mar 2008 23:14
Hello everyone.

Enigma here As most of you should know, I am in a class in school for learning how to code in DarkBasic. Well, we are working on a project (just to get the hang of different commands) where we start out with a plain, a cube (rectangular shaped) and really thin cylinders along the axis for reference when playing. It displays the coordinates and angles and such as well. We then needed to load a goblin in, and make him walk around be able to jump. We then had to texture the goblin, and make collision boxes... This is where the problem sets in...

Now, I can make it where I just do the simple code for collision boxes..


Maybe some of the semantics of that code isn't right, not sure if it is create collision box or make. Anyways, that way works well, but I want to make it where the collision is set to the polygons.

I have it where the collision is set to the polygons... The goblin can walk around, and his collision works perfectly.... Well.... When I try to rotate the cube.. the computer crashes. Well, I am not sure if it is a crash, but it nonetheless freezes. I can still press ctrl+alt+delete. If you could look over my code, and see how to keep it as set collision to polygons 6 will work with this I would greatly appreciate it. Thank you for your help!

Oh, and here is the code =p I sincerely apologize if some of it is malindented..

Oh yeah. Forgot. The texture I use, and maybe the goblin itself wont work. You can rem the Texture out if you want, and if any other media (just pics, no sounds) problems occur, just change them to fit your comp.


Regards,
Enigma
-Mike

All hope is lost when one subjects to the malevolence of apathy. ~by me~
Trust in someone is a greater compliment than love. ~By me~
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 7th Mar 2008 07:10 Edited at: 7th Mar 2008 07:14
Quote: "I sincerely apologize if some of it is malindented"


Proper indentation does make it a lot easier to follow...

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

But, more important than the indentation, your program layout is a bit suspect - what we would call spaghetti code. It's not modular and forces you to use Goto (never a good idea).

It's also more difficult to add to later on. Help here:

http://www.computechtenerife.com/layout.htm

The program freezing could well be down to this so structuring your program correctly may also fix the problem. If it doesn't, it will certainly make finding the cause a lot easier!

TDK_Man

Enigma
17
Years of Service
User Offline
Joined: 11th Dec 2007
Location: In your closet
Posted: 11th Mar 2008 02:29
Well, it is a school project as I have said before, and all of this is kind of code as ya go type stuff. This isn't the serious project, so we aren't too serious with organizing the code just right, though I will do that when I get back to school. I am ahead of the class with what I need to do, so i can work on that.

If you, or anyone else would like to look at the code after it has gone through TDK_Man's tidy process, here it is.



I have not gotten it into DarkBasic yet, so I don't know if the problem is fixed quite yet. Also, if you haven't already read it, the game crashes when I try to rotate the cube. Please check it out and help me with this, I can go back to making the collision a box, but I would like to use the polygons.

Thank you for your time,
-Mike

All hope is lost when one subjects to the malevolence of apathy. ~by me~
Trust in someone is a greater compliment than love. ~By me~
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 11th Mar 2008 11:35
Quote: "If you, or anyone else would like to look at the code after it has gone through TDK_Man's tidy process, here it is."


Sorry, but DBA Tidy will only work if a) you read the instructions and b) your program doesn't contain formatting errors.

You have lines in your program which end in colons. These mean that another statement follows. As nothing does on these lines, it confuses DBA Tidy when it is scanning for the ends of blocks of code.

It works best with Gosubs and procedures - Goto and Labels, (as well as not being very good practice to use), don't get indented.

There is also no way for DBA Tidy to know whether:

EndSection:

..is a label or or a procedure header. The rule with DBA tidy is that if it is a label then it should have a Rem on the end. If you do this with the two labels in your program and kill the illegal colons, then DBA Tidy outputs this:



TDK_Man

Enigma
17
Years of Service
User Offline
Joined: 11th Dec 2007
Location: In your closet
Posted: 12th Mar 2008 01:30
Well, I don't have time to mess with the code anymore with the set collision to polygons.... I set it back to just being a collision box, and it works fine, I guess I will have to go with that.. You can lock this thread then if you like.

All hope is lost when one subjects to the malevolence of apathy. ~by me~
Trust in someone is a greater compliment than love. ~By me~

Login to post a reply

Server time is: 2025-06-04 03:17:18
Your offset time is: 2025-06-04 03:17:18