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 / Need help debugging a 3D jump + collision program - DBPro

Author
Message
filya
18
Years of Service
User Offline
Joined: 23rd Aug 2006
Location: USA
Posted: 12th Mar 2007 00:08
Hello everyone,

It's been just 4 days now that I have downloaded the DB Pro trial version. I went through a few basic tutorials and tried making a simple program which would detect & avoid collisions, and let the player (a simple box) jump over platforms etc

Here's the complete source :





Now the first problem I am facing is that none of the objects I create appear on the screen
Also, using the print command I tried printing the plr box positions for debugging. Those indicate that I havent done the program too well


If someone could point out my mistakes to me, I shall be most grateful. You do not have to rewrite the whole code, just point out where I went wrong and what I could change.

Also, the collision system I have used is a very basic one (it just checks for collision and moves the player a few steps away). I intentionally avoided trying to use (or make) a complex one.

Thank you for all your help,

filya

-- game dev is fun...but taking up too much time --
Inverted
18
Years of Service
User Offline
Joined: 19th Nov 2006
Location: Oregon
Posted: 13th Mar 2007 05:40 Edited at: 13th Mar 2007 05:43
Your first problem is that you dont have a loop.



- A few things i saw, "until escapekey()=1" the escape key by default will close your program, there is no need for this.
- Also, "wait key" will stop the program completely until a key is pressed, avoid using this; others will say differently; but i prefer not to use this command to often.
- Your sync command should be at the END of your code, the screen should be updated as the last thing, not mid program; this will cause some objects not to show up. I saw that you updated your screen with sync after every print command, you can update your screen all at once just with one sync at the very end of your code.
- I noticed you documented "program starts", "program runs"; this is not needed and will not show up because the program is moving swiftly.

- Another tip is to use sub routines:
unstead of having a huge loop like:



Thats not very big but with a huge loop it can almost be impossible to find things.

What you can do though is:



This way you can now search "playermovements" in DBP and find it easily, and it just allows a much more organized place to work from.

As for your program I couldent figure out exactly what you were trying to do.
If you create any more code I'd be glad to look over it for you.

Cheers,
-Inverted

PS: I messed with your code for a while and i got the object to be in sight, although it probably isnt what your looking for, sorry if you couldent help you on this one:



Come take a look!
filya
18
Years of Service
User Offline
Joined: 23rd Aug 2006
Location: USA
Posted: 13th Mar 2007 07:04
thank you for your reply Inverted. I have been impatiently refreshing this thread every 15 minutes to see if I got a reply

So now atleast I can see my objects on screen I shall modify this code till I manage to do what I tried to.


I really appreciate your tips and shall use them for better coding.

As for your comments :

1. I used the 'repeat-until' loop instead of the 'do-loop' loop. I didn't know esc key works as default. Thank you.

2. Regarding the 'wait key' and 'print' statements; I did that for debugging purpose. I just added those to see if my program even ran (since all I could see was a black screen)

3. I added the 'sync' before the 'wait key', since the program won't run all the way to the end without a key input.

4. As for my program (what I have tried doing so far) is :

make my player box jump and move about the other 2 stationary boxes. I tried adding some simple collision system and basic movement along with jump implemented.



Thanks again for your help,

Shall keep updating this whenever I need some more help.

-filya

-- game dev is fun...but taking up too much time --

Login to post a reply

Server time is: 2024-11-25 21:29:10
Your offset time is: 2024-11-25 21:29:10