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 / non-rectangular sprites?

Author
Message
Jedi Padawan
15
Years of Service
User Offline
Joined: 17th Jun 2009
Location: None of your business
Posted: 3rd Jul 2009 08:24
I've noticed that in sprite collision, when the two sprites' boundaries hit, the boolean works.

So if I have a dog picture, there is a rectangular outline that is the outline of the sprite and the other sprite(say a bone) w/ another rectangular outline.

When the spritr collides, the dog doesn't have to touch the bone, just the rectngular outlines of the pictures have to touch.

Is there any way that the sprite outline can be of diff. shapes, like maybe a dog and a bone?

I hope you all understand what I am trying to syay. If you dont, I will post a .bmp explaining this.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 3rd Jul 2009 15:17
Search for "pixel perfect collision".
I don't do much with sprites myself, so I myself cannot help, I'm afraid.

Deego
16
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 3rd Jul 2009 17:55
There are two methods. Both involve searching 'pixel perfect sprite collision."

1. In an imaging program, take your sprite and make the area you don't want to check for collisions transparent. Then save it as a type of file that has a built in alpha channel; png or tga work well. Then use the PPSC function you built after looking up the searches to check for collision.

2. If your graphics program isn't complex, you can set a color to be the alpha channel, such as rgb(255,0,255). Just make the areas you want to be transparent a certain color, and there's a command in DBPro to make that color the alpha channel. Look in the commands section of the help files.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 3rd Jul 2009 19:33
You could also use the POINT command to check every single pixel under the sprite for colors that you deem as a collision. Many people don't like to use POINT because it's too slow for them (not me of course).

Jedi Padawan
15
Years of Service
User Offline
Joined: 17th Jun 2009
Location: None of your business
Posted: 3rd Jul 2009 23:08
i kinda get it but could someone explain all the terms (alpha channel)...
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 4th Jul 2009 04:53
An Alpha Channel is the transparancy layer in a graphic file. Most commonly PNG or DDS format. If you use art programs like GIMP, or Photoshop, you don't have to use a soild colour for the background. Instead you can use a transparant colour that allows you to see through your graphic, to the objects or graphic behind it.

So in short, Alpha = Invisable bits of a graphic file you can see trhough.

Jedi Padawan
15
Years of Service
User Offline
Joined: 17th Jun 2009
Location: None of your business
Posted: 4th Jul 2009 05:51
ahhh...

i learned from other forums that 'pixel perfect sprite collision' is a function you use to define the said type of collision.

Is that right?

Login to post a reply

Server time is: 2024-11-25 04:51:48
Your offset time is: 2024-11-25 04:51:48