forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Overlapping dialog elements?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Feb 18, 2003 12:35 am    Post subject: Overlapping dialog elements? Reply with quote

Is there a way that I can tell if dialog elements are overlapping each
other? I've tried several times to attempt to solve this problem and I
have come up with no solution. Confused

I've tried something like:
Code:
if @both(@greater(@fsub(%%top,16),@dlgpos(element,T)),@greater(@fsub(%%left,16),@dlgpos(element,L)))


But I don't really know how to find if they're overlapping each other. Confused

Any tips would be appreciated very much. Very Happy

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Feb 18, 2003 12:50 am    Post subject: Reply with quote

If the elements can use a STYLE, ya can test it using a
background color to show where it's actually located... Wink
Code:

OPTION SCALE, 96
OPTION DECIMALSEP, "."
TITLE By Mac
DIALOG CREATE,"Test Program",-1,0,200,60
  DIALOG ADD,STYLE,S1,,,,CYAN
  DIALOG ADD,STYLE,S2,,,,LTGREEN
  DIALOG ADD,TEXT,T1,5,5,,,"Test Text",,S1
  DIALOG ADD,CHECK,CK1,30,5,,,"Test Checkbox",,,S2
DIALOG SHOW

:EVLOOP
  WAIT EVENT
  goto @event()

:CLOSE
  EXIT

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Feb 18, 2003 12:58 am    Post subject: Reply with quote

Thanks for the idea, but I should make myself clear: I will need to be
checking through code, not the human eye.

But thanks anyway! Very Happy

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Feb 18, 2003 4:15 am    Post subject: Reply with quote

Ok... why do ya need to check element overlap with code? Confused

It'd help if we know what you're tryin' to accomplish... Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Feb 18, 2003 2:47 pm    Post subject: Reply with quote

Sorry... Embarassed

It's for a type of "game" in which you have to avoid obstacles. If one bitmap
overlaps the other then basically you've hit an obstacle.

I'm pretty sure that it would work with some type of code using @dlgpos(),
but I'm not sure about the math that's needed.

I hope this helps you understand better. Wink

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Feb 18, 2003 9:16 pm    Post subject: Reply with quote

OK - I'd keep the element names and positions in a list something
like this:

Element1|30|100

You can then find it with @match(), PARSE to check it's position,
and update it as needed. If the elements are different sizes, ya
can add the width and height also. Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Feb 18, 2003 9:18 pm    Post subject: Reply with quote

Another thing ya might do is cut your layout into an invisible
grid, and when a piece is in that grid space, mark it as occupied.

It's been a while (so I don't really remember), but I prolly used
this method on the checkers game... Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Tue Feb 18, 2003 9:29 pm    Post subject: Reply with quote

They're all good ideas, but in my case I don't think they will help. Sad
The reason for that is that I generate a random number of bitmaps
and you need to move left or right to avoid the oncoming objects.

I'm thinking I'm closer with @dlgpos() to get the object position and the
other object's position and do some math calculations and come up with
an answer to whether they're overlapping each other or not.

Thanks again for all of your ideas and help, they are greatly apprecieated! Very Happy

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Feb 18, 2003 9:42 pm    Post subject: Reply with quote

Well, it's your baby.... Wink

The thing is - if ya gotta check all positions of every piece,
I think it'd be faster/easier to run thru a list in a loop. Ya
would put the location data in the list when the elements
were created.

I'd like to see it when ya get done. Smile

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Feb 18, 2003 9:49 pm    Post subject: Reply with quote

Question - are all the pieces we're dodging the same size?
_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Tue Feb 18, 2003 10:29 pm    Post subject: Reply with quote

Never mind... here's a basic collision detection routine if that's all
ya wanted. It's not tested, but ya should get the idea... Wink
_______________________________________________________________________________________________________________________________________________________________________________________
Code:

if @both(@greater(@sum(%%player_x, %%player_width), %%object_x), @greater(@sum(%%object_x, %%object_width), %%player_x))
   if @both(@greater(@sum(%%player_y, %%player_height), %%object_y), @greater(@sum(%%object_y, %%object_height), %%player_y))
      INFO Collision!
   end
end

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Wed Feb 19, 2003 2:05 pm    Post subject: Reply with quote

FreezingFire, the loop Mac is telling about is in a way the same as all the MouseOver codes that are posted over here... Maybe you should take a look at one of those?
Back to top
View user's profile Send private message
Mac
Professional Member
Professional Member


Joined: 08 Jul 2000
Posts: 1585
Location: Oklahoma USA

PostPosted: Wed Feb 19, 2003 2:09 pm    Post subject: Reply with quote

Slight difference - ya gotta allow for both the width/height of the
player and width/height of the object... Wink

Cheers, Mac Smile

_________________
VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
Back to top
View user's profile Send private message Send e-mail
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Wed Feb 19, 2003 2:21 pm    Post subject: Reply with quote

Well, if FreezingFire uses your code, and the loop of one of the Mouseover codes, it might work...
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Feb 19, 2003 9:57 pm    Post subject: Reply with quote

Mac wrote:
Question - are all the pieces we're dodging the same size?


Yes. Wink

Also thank you for the code... I think I've got an idea now! I just needed
the help to get started. Again, thanks. Very Happy

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group