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 / a few questions =-)

Author
Message
slicer 4 ever
18
Years of Service
User Offline
Joined: 11th Jul 2006
Location: currently: planet gamma3295
Posted: 28th Aug 2006 05:11
note: i'm sorry for my spelling and grammer and any other mistakes theres no need to point them out as i already know i suck at spelling

recently i went on vacation and had no access to the internet even though i had my laptop with me anywho i was busy writing programs when i slowly gained questions on how to do things so here they are:

1.rotating an object:
when i was working i discovered curveanle/curvevalue in the index so i did some tinkering around and found they are great for finding the angle between 2 objects using 2 variables of course it is easy to do this on a 2d world but when trying to rotate an object to face another object is where i have my problem i've tried several things:

rotate object 1,curveangle(x2 + z2,x1 + z1,20)

i've tried otherways but can't figure out how to find the angle between 2 objects and then rotating ine object to face the other

this is on my top priorities to figure out as it would extremly help me

2. screensavers
i discovered you can make screensavers in darkbasic but if you notice when you go to set up your screen saver in say windows xp it has that little screen in which the preview goes and the default screensavers go there so i ask how do you make it so your screen saver prevous there and not a full screen prievew

also i noticed that the default allow you to set things up via the setting tab next to the preview button so i ask how do you utilize it if you can

3. o and last thing:

this doesnt have to do with dark basic but does anyone know of an converter program that o say does:
pixel to inches
inches to feet
feet to yards
yards to meter

so on and maybe some other type of conversions

thanks in advance for any helpful answers=-)

my smiles love me =-)=-)=-)(-=(-=(-=
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 28th Aug 2006 09:55 Edited at: 28th Aug 2006 09:56
1) To find the angle between 2 points in 2D, we usually use atanfull(difX, difY). It gives you the angle between those points. You can use them in 3D too, but you'll have to run more than 1 atanfull to recover all the angles.

2)I honestly don't think there's a solution for this. I think it has to do with the file type. And the settings button can't be used either.

3)You can't say that a pixel can be converted to inches (The rest can be done easily). That is because a pixel is relative. But what you can do, is specify your own measure. For example: if you take 2 pixels for 1 inch, then the conversion can be calculated. But you can take 10 pixels or 300 pixels per inch just as easily.

If you want conversion between the rest, maybe you can create your own program. I'm sure google has all the information you need. Google has its own built in unit converter.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 28th Aug 2006 13:45
About the screensaver thing... Mine appears there fine! You need to make the EXE a .scr file, and then you need to put it in your C:/WINDOWS/System32 folder. It should appear.

slicer 4 ever
18
Years of Service
User Offline
Joined: 11th Jul 2006
Location: currently: planet gamma3295
Posted: 28th Aug 2006 19:27
@ sixty squares yes i figured that part out fine mine of course makes a full screen prieview but i guess if you can't get around it whatever
if yours works fine could you post code for one that works like that so i can see if your adding sometin
thanks if you can=-)

@seven b ok i'll do some tests and see if i can figure it out=-)
also i'm asking pixel to inch because at my school they had a converter program that did this and it was like 1.29 pixels per inch but i'm not sure that's why i asked as i'm trying to get measurments right because i'm ganna attempt makeing a ship that can fly around our solar system anywho i'll try atanfull and thanks=-)

thanks all=-)

my smiles love me =-)=-)=-)(-=(-=(-=
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 29th Aug 2006 03:59
Yeah mine makes a full screen preview too, but who cares... Long as the screen saver works I'm good!

slicer 4 ever
18
Years of Service
User Offline
Joined: 11th Jul 2006
Location: currently: planet gamma3295
Posted: 29th Aug 2006 08:04
o ok anywho @seven b could you post an example i've been at it for several hours and can't figure it out or at least point me to an example thanks in advance=-)

my smiles love me =-)=-)=-)(-=(-=(-=
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 29th Aug 2006 20:54


There's only one thing I should explain, and that is why I did
atanfull(mousex() - SX, (screen height() - mousey()) - SY)

The reason why I did that, is because mousey() starts counting from the top of your screen. So, if your mouse is all the way above on your screen, mousey() = 0, if it is on the bottom, then it will be the screens height (screen height()).
To invert this, I substracted the mouse y position from the screens height.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
slicer 4 ever
18
Years of Service
User Offline
Joined: 11th Jul 2006
Location: currently: planet gamma3295
Posted: 30th Aug 2006 19:49
@ sven b
thanks alot that really helped out i seen what i was doing wrong you confused me by saying:

you'll have to run more than 1 atanfull to recover all the angles

so i was trying things like:

angle# = wrapvalue(atanfull(x1,z1) - atanfull(x2,z2))

and other stupid stuff but now it's working properly with:

angle# = atanfull(x1 - x2,z1 - z2)

thanks again this well really help =-)

my smiles love me =-)=-)=-)(-=(-=(-=
slicer 4 ever
18
Years of Service
User Offline
Joined: 11th Jul 2006
Location: currently: planet gamma3295
Posted: 31st Aug 2006 07:06
new question

sry for double post:

ok i just remebered a question i had while i was on vacation:

is there a way to load an image with a variable for example:

i have a 100 images so i name them 1,2,3...so on till 100

i make a variable
number_of_images = 100

then i tried to load them in with a for loop
for i = 1 to number_of_images
load image i,1
next i

that gave me an error:
loading image expects string
sometin like that

so is it possible to do it that way?

my smiles love me =-)=-)=-)(-=(-=(-=
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 31st Aug 2006 16:04 Edited at: 31st Aug 2006 16:05
Yes, but not like this:



You see, load image has 2 parameters: filename$ and image number. What you did, was placing the variable i (which contains an integer) on the place of the filename$ parameter.
If you want to load images from 1 to 100 that are called "1.bmp", "2.bmp", "3.bmp", etc., then you should type str$(i)+".bmp" on the filename$ parameter (which has to be a string).

The second parameter, is the image number. And in your case, this is always 1 (like you typed). This will not return an error, but will just overwrite the image you stored last in number 1. Therefor, the only image you will be able to acces, would be the last one you loaded.
If you want to load 100 images, with all different image numbers, then you should type i on the image number parameter.

So the possible solutions would be:
load image str$(i)+".bmp", i
or
load image "ImageFileName.bmp", i

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
slicer 4 ever
18
Years of Service
User Offline
Joined: 11th Jul 2006
Location: currently: planet gamma3295
Posted: 31st Aug 2006 22:27
o ok i see so to take a number variable and turn it into a string i just type: str$(variable name)+"string"

ok i understand thanks=-)

my smiles love me =-)=-)=-)(-=(-=(-=
slicer 4 ever
18
Years of Service
User Offline
Joined: 11th Jul 2006
Location: currently: planet gamma3295
Posted: 4th Sep 2006 05:52
ok another question i just thought up and trying to keep "most" of my question in the same thread when trying to make an rts you need mouse control yet when i try but due to diffrent z values it no worky so i ask is there a way to click on diffrent objects even at diffrent z values?

my smiles love me =-)=-)=-)(-=(-=(-=
slicer 4 ever
18
Years of Service
User Offline
Joined: 11th Jul 2006
Location: currently: planet gamma3295
Posted: 5th Sep 2006 23:05
ok i asked badly i'll try again:

is there a way to detect when the mouse is on an object even with diffrent z/y/x values

i hope that is a better way to put it

my smiles love me =-)=-)=-)(-=(-=(-=
slicer 4 ever
18
Years of Service
User Offline
Joined: 11th Jul 2006
Location: currently: planet gamma3295
Posted: 9th Sep 2006 09:13
well either your ignoring it or just don't understand either way i guess it well have to wait anywho i have a new question:

i make a 2d circle on the screen now then is there a way to check when the 2d circle comes into contact with a 3d object? even if the 3d object is far off in the distance or up close?

thanks in advance

my smiles love me =-)=-)=-)(-=(-=(-=
Sven B
20
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 9th Sep 2006 11:08 Edited at: 9th Sep 2006 11:09
Quote: "is there a way to detect when the mouse is on an object even with diffrent z/y/x values"


You can find an objects position on the screen by using object screen x(obj) and object screen y(obj). These commands return the screen coordinates of an objects pivot point, and not the center of the object!

Quote: "i make a 2d circle on the screen now then is there a way to check when the 2d circle comes into contact with a 3d object? even if the 3d object is far off in the distance or up close?"


Yes there is. If you search the distance from the circle center to the objects screen coordinates (look above), you can find collision. The distance has to be < or = the radius of the circle.

Good luck!

Sven B

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
slicer 4 ever
18
Years of Service
User Offline
Joined: 11th Jul 2006
Location: currently: planet gamma3295
Posted: 10th Sep 2006 21:31
i think i understand what u mean thanks=-)

my smiles love me =-)=-)=-)(-=(-=(-=
Gamer Making
18
Years of Service
User Offline
Joined: 20th Sep 2006
Location: sitting at the comp programming
Posted: 24th Oct 2006 03:12
Hi Lets start another question. How can you make "load gambit 7.bmp",1
the bit map move?

Bach Tran

Login to post a reply

Server time is: 2025-05-25 22:49:06
Your offset time is: 2025-05-25 22:49:06