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 / A few Questions about DB pro

Author
Message
Zuluguy
15
Years of Service
User Offline
Joined: 3rd Aug 2009
Location:
Posted: 9th Aug 2009 02:15 Edited at: 9th Aug 2009 02:21
Hey. i have asked for quite some help recently because i really want to get into programming in DB pro and i just have a couple of questions i am not sure on.

The first question is. How does the load(anything) command work? i mean i know it will load it for use in a program but how does it find the file? a couple of times i have tried to use this it has not worked, i have specified the file name with correct caps if needed or numbers even but it does not seem to find the file. Do i need to specify C:My Documents(backslash)My Pictures(backslash)(file name) or can i just specify My Pictures(backslash)(file name). because every time i have used the second one it never works.


My second question is. How do i find the posistion to place objects, text or even sprites. is it based on trial and error or possibly even a program that will give the location lets say where your mouse is on the screen? Or even when you get good at programming in BASIC you just know the aproximate area you want it then base it around that?

Thanks for reading this and to all those who have helped me so far.

-Edit- i am guessing it takes Back slashes as html code or somthing(i think html because im pretty sure it cant be used in this forum)
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 9th Aug 2009 02:50 Edited at: 9th Aug 2009 02:52
Question 1:

Whenever you're loading something you either provide an absolute path, or a relative path. If you provide an absolute path then you're providing the location of the file on your hard drive, so it might look like "C:/Users/Andrew/Pictures/MyPic.png". However typically you don't do this, instead you provide a relative path. This path is relative to your game's EXE file. If the file is in the same folder as your EXE you can simply load it using it's file name, e.g. Load Image "MyPic.png". However if it's in a subfolder you'll have to include the folder it's in, e.g. Load Image "Media/MyPic.png".

Question 2:

When I'm positioning text and sprites it's often through trial and error, unless it's something that would be randomly positioned such as an asteroid in a space shooter. For 3D objects, I typically use a map editor such as 3DWS, WORLD, etc. which will output a map file containing the positions, rotations, etc. of all the objects that can be loaded into DBP.

i like orange
Zuluguy
15
Years of Service
User Offline
Joined: 3rd Aug 2009
Location:
Posted: 9th Aug 2009 03:30
@ Question 1. So does the Image sound or what ever need to be in the game Exe folder for it to be on a relative path

@question 2. Ok thanks for that >.<
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 9th Aug 2009 04:02
Quote: "@ Question 1. So does the Image sound or what ever need to be in the game Exe folder for it to be on a relative path"


Most of the time the files you load will either be in the same folder as your EXE or a 'Media' folder of some kind, and the Media folder will be in the same folder as the EXE. If you're loading an image that's in the same folder as your EXE you can just load it by it's filename, i.e. Load Image "MyImage.png". If you have, say, a 'Media' folder that's in your EXE folder and your image is in there then you would use Load Image "Media/MyImage.png"

i like orange
Zuluguy
15
Years of Service
User Offline
Joined: 3rd Aug 2009
Location:
Posted: 9th Aug 2009 04:45
Right. Ok thanks a bunch AndrewT i understand it now .

Cheers.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 9th Aug 2009 08:00
For 2D it's easy to use a drawing program to determine exactly where you want all the graphics to be in your projects. I use Paint Shop Pro because it always shows the x and y coordinates in the lower left corner of the screen. So when I want to position something I just put my mouse on the pixel I want the graphic to be at and look in the lower left corner.

In the attached picture you can see in the upper right circle the pixel I'm currently on (the tiny little green box), the lower left circle shows the exact coordinates for that pixel, and the lower right circle shows the size of the entire image. The image is zoomed in a bit so the pixels appear larger than normal.

Attachments

Login to view attachments
Zuluguy
15
Years of Service
User Offline
Joined: 3rd Aug 2009
Location:
Posted: 9th Aug 2009 14:54
Ahh yes i have noticed this in GIMP when i have previously used it.
Thanks for that Grog
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 9th Aug 2009 18:52
Np.

Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 9th Aug 2009 23:51 Edited at: 9th Aug 2009 23:52
Quote: "This path is relative to your game's EXE file"

Actually, it appears to be equal to the folder from which the executable was run.
Usually that would be the same as the folder of the exe (ie. you doubleclick on it's icon in the specified folder), but assume that you have a second DB program that uses execute file to run it. Then you will have the path of the other executable as the relative directory. (Or that command actually allows you to specify another path to run from). That isn't a very relevant circumstance perhaps, but for example, open up a "blank" project in the default DBP IDE, then save it as a set project, and it will still execute a compiled program from the TEMP directory. Or use the command prompt to run the file; the relative dir would be C:\Windows\System32 I believe.
Just pointing it out

Edit: oh yes, don't forget about shortcut files.
That can cause some serious problems if the relative directory is always supposed to be that of the exe itself.

Zuluguy
15
Years of Service
User Offline
Joined: 3rd Aug 2009
Location:
Posted: 10th Aug 2009 01:15
Ah ok thanks Rudolpho
Emphasoft
17
Years of Service
User Offline
Joined: 2nd Jun 2007
Location: Deep Underneath the Center of the Earth
Posted: 12th Aug 2009 17:18
I usually create an editor program that I can use to output positions based off of mouse position. That way,there is no trial and error.

Salvation and Sickness are in every heart. Death and Deliverance are in every hand.
-Orson Scott Card

Login to post a reply

Server time is: 2024-11-24 02:58:01
Your offset time is: 2024-11-24 02:58:01