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 Professional Discussion / Excluding transparent areas in sprite collision?

Author
Message
Deego
15
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 18th Jul 2008 03:27
I found a pixel perfect sprite collision code in the Code Snippets forum but I couldn't get it to work. So I've been thinking about other things.

Is there a way to ignore transparent areas of a sprite during collision? Or, say, a Check Transparency command.

Like,
if Check Transparency = false then hit = sprite collision(a,b)

Or, is there a way to create a collision zone for the sprite by designating x,y coordinates on the sprite's image to form a collision polygon? Just like using an image map in HTML?

The idea I have right now is to create a bunch of small sprites and position them so they occupy the ideal bounding box of the sprite, and then check for collision on the bounding box sprites but that seems far too complicated to repeat for multiple sprites.
Ed222
16
Years of Service
User Offline
Joined: 3rd Nov 2007
Location: Calgary
Posted: 18th Jul 2008 03:35
use this by windowskiller although the mirror sprite command doesn't give prefect collision but close enough to perfect.

Deego
15
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 18th Jul 2008 04:38
I tried that and couldn't get it to work, and that thread isn't open to new replies. Trying to run a program with what's provided there results in DBPro crashing. There's no documentation for it.
Ed222
16
Years of Service
User Offline
Joined: 3rd Nov 2007
Location: Calgary
Posted: 18th Jul 2008 06:44
could you show me the code your using? just saying it crashed won't help

Deego
15
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 18th Jul 2008 19:53 Edited at: 18th Jul 2008 19:54
The problem is, I can't find which piece of code is the problem. I get an error that DBPro isn't working when I try to compile, even when all I changed is pasting the functions to the end of the code. The error doesn't specify what's causing it, only that "DBPro has stopped working." I'm running Vista but I ran into the same problems using XP.

I set up this quick program to test it. There should be little here to cause problems. Couldn't get it to work, but maybe someone else can. Everything is in the download.

Attachments

Login to view attachments
Deego
15
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 18th Jul 2008 20:15
Well, I didn't include the code, seeing as how it wouldn't work with it, and it's fairly easy to copy and paste.

And I'm using v1.054. I'll try it again after an update. I thought the initial download would be the most recent version, but apparently there's a v6.9.
Ed222
16
Years of Service
User Offline
Joined: 3rd Nov 2007
Location: Calgary
Posted: 18th Jul 2008 20:42 Edited at: 18th Jul 2008 20:45
@windowskiller
I know this is off topic but your pixel collision tread got lock so I couldn't ask it there, anyways are you still adding the mirror support and scale support or is this function dead?

Deego
15
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 18th Jul 2008 23:20
Well, pixel perfect sprite collision is out for me, since in my current project all of my sprites are scaled to create 'depth'. I'll be sure to include this in my next project. Thanks!

Login to post a reply

Server time is: 2024-05-19 12:24:07
Your offset time is: 2024-05-19 12:24:07