123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|418|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> ImagesCollide vs. RectsOverlap

Sun, 22 Jun 2008, 04:59
Jayenkai
Yeah, if it's just a bunch of squares, there's no point in using anything other than RectsOverlap.

Imagescollide is marginally slower, but for the amount your checking it probably wouldn't be too bad.
Even so, rects should be quicker....

-=-=-
''Load, Next List!''
Sun, 22 Jun 2008, 05:49
JL235
The speed increase will depend entirely on how many collisions your checking. If it's only a few then you will probably see no difference when it's running. If it's in the thousands and thousands then the difference in speed will be quite significant.

If it's only rectangle shapes then you might as well use RectsOverlap, however bear in mind that ImagesCollide will almost certainly perform some similar bounds checking to RectsOverlap internally. So if they are not overlapping then it should be as fast as RectsOverlap.
Sun, 22 Jun 2008, 18:29
Forklift_Fred
How about ImagesOverlap rather than ImagesCollide?

I imagine RectsOverlap is still going to be quicker but that can only be because you specify the sizes when you call it rather than ImagesOverlap which needs to look up the image sizes.

Personally, I'd go for ImagesOverlap because it will be easier to update to ImagesCollide if the need arose later on.

Or would I be wrong?

-=-=-
Come rain or shine...
Sun, 22 Jun 2008, 23:40
Scherererer
Only if the image's size was constant -- it would make no difference using ImagesOverlap or RectsOverlap if you had to look up the height & width of it, but if you knew that it was always 32 pixels wide & high, then RectsOverlap would be faster.

-=-=-
YouTube Twitter
Computer Science Series: Logic (pt1) (part 2) (part 3) 2's Complement Mathematics: Basic Differential Calculus
Mon, 23 Jun 2008, 05:33
LostUser
Be careful with collision detection with Blitz Basic 2D. I remember when I made, but never finished, my "1945" clone - I used imagescollide (I think) and eventually the whole program slowed down so much it became unplayable.

I did find a library called " 2D 'Shifted Grid' collision detection demo by big10p (A.K.A. Chris Chadwick) 2004."

I'm going to post this entry into the snippets section.