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 / [DBPro] 2D collision without sprites.

Author
Message
Tobo
19
Years of Service
User Offline
Joined: 12th May 2005
Location:
Posted: 30th Aug 2006 08:12
Wotcha, folks.

I'm sure this must have been asked a 100 times, but I simply can't find any mention of what I'm specifically after.

I'm a BlitzBasic person trying to cut my teeth on DBPro. With BB, you had a very effective and simply collision commnd called...

rectsoverlap (x,y,20,20,x1,y1,20,20)

...which basically checks the position of two rectangles to see if they overlap.

Is there such a command in DBpro, or are all collision commands restricted to sprites?

Reason I ask, is that I'm trying to put together some background code of a 2D maze/platformer game, and I'm working with 'box'es at the moment, rather than sprites.

My code may better explain it.



Many thanks,

Tobo
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 30th Aug 2006 10:20 Edited at: 30th Aug 2006 10:23
There is no such command in DBP. However, it is very easy to make your own function to perform the same command.
Try this:

I am not sure how the parameters are set in Blitz but in my function they are:
x1 = Left of box 1
y1 = Top of box 1
w1 = Width of box 1
h1 = Heigth of box 1
etc ...


Tobo
19
Years of Service
User Offline
Joined: 12th May 2005
Location:
Posted: 30th Aug 2006 11:05
Cheers, Scraggle.

T

Login to post a reply

Server time is: 2024-09-25 07:35:05
Your offset time is: 2024-09-25 07:35:05