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 / Coordinate Problem

Author
Message
Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 7th Aug 2006 16:30
I have two images,both of them are clickable. There sizes are both
29x33 images. One of them is positioned at 12,12 how would I get the other image right beside of the first image? I mainly need coordinates.
(E.G. ||)

Thanks Alot!

Zergei
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 7th Aug 2006 17:08
Well, if the first image is at x=12 , and it's width=29 , then just :

x+width = where the image finishes and should start the other one.

Accordingly to how you grab the image, or the size of it, it may need a +1 or not, why?. Sometimes one forgets that 0 counts, so a 29x33 might be 30x34. But if you took care of that, the no worries.

Hope it helps...
Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 7th Aug 2006 19:39
Okay so I add the x coord plus the width and get that, but how do I use that with the second image?

Zergei
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 7th Aug 2006 21:40
You'll use that x+width value as the x coordinate for the second image, so to paste it right where the first image finishes.
flock
18
Years of Service
User Offline
Joined: 10th Mar 2006
Location: Earth
Posted: 8th Aug 2006 03:14
Math, man, math...

a.k.a. "flockhound"
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Aug 2006 13:15
If image is positioned at X and the image is W pixels wide, then the edge of the image must be at X+W. If X+W is the end of the image, naturally thats where you should place the second image.

X+W = X2(second image)

This is simple grade school math here folks.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 8th Aug 2006 16:08
Okay. Got it! Thanks.

RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 9th Aug 2006 04:22
A slight correction, if you want the second image placed directly beside the first;

X = x coord of first image
W = width of first image
W2 = width of second image

X position of second image = X + (W/2+ + (W2/2)


Projects: Online CTF Game | Newcommer's Guide to FPS's
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th Aug 2006 05:46
I assumed the position was the top left corner, not the center.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 9th Aug 2006 06:10
Either way, using your method the second image would be positioned overlapping the first if it's width was greater than the firsts. This way, the second image is always positioned directly beside the first, with the first's furthest right pixels lining up right to the left of the second's farthest left pixels.


Projects: Online CTF Game | Newcommer's Guide to FPS's
Zergei
19
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 9th Aug 2006 06:33
Er... RUCCUS, Phaelex is right. Coordinate (0,0) of a not-offseted-image is it's top left corner, so it's x position + it's width will be the coordinate to position the 2° image.

Further on my stuff at...
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 9th Aug 2006 12:23
Sorry I forgot image positions are in the top left corner, used to using 3D where the position is the centre.


Projects: Online CTF Game | Newcommer's Guide to FPS's

Login to post a reply

Server time is: 2024-09-25 05:26:31
Your offset time is: 2024-09-25 05:26:31