Page 2 of 2
Posted: Fri Jun 23, 2006 10:53 am
by Fred
There is the SpritePixelCollision() which should also work almost correctly if your alpha sprite doesn't have too much shadow around it.
Posted: Fri Jun 23, 2006 10:59 am
by Preludian
Unfortunately not ;( I have a masked PNG file. And even the nicest mask doesn't help. If you want I can send you the file to see for yourself if you don't believe me?
Edit: I just sent you an email (support@....) because I'll be home later on again and in case you would like to have a look.............

it's a png and the code
Posted: Fri Jun 23, 2006 11:04 am
by netmaestro
You might need to make a second 2-color 2d sprite from the original 2d sprite you used as a texture, which is white where you want it to collide and black everywhere else. If you use that "mask-sprite" for collision testing, it really should work without problems.
Posted: Fri Jun 23, 2006 3:26 pm
by Preludian
@netmaestro: I know, but this would mean much more work and memory usage. I'd prefer not having to do it this way. Unfortunately I had to crop the sprites to a minimum for the collision to function, but now I do not have 2^x Sprites and I heard that even some newer ATI cards had problem with this, so if Fred doen't come up with a decent solution I will have to resort to the way you mentioned. Well thinking of it, I doubt that Fred will want to fix this one during the weekend, so

oh well... but I really would prefer not having to code around bugs, this isn't meant PB specific, few applications are bullett proof, but annoying it is always...
Posted: Fri Jun 23, 2006 10:53 pm
by Preludian
Huray! I have found a way
I simply had to save the image as an png WITHOUT transparancy but with a black background.
Then I had to take #PB_Sprite_AlphaBlending out and voilĂ , it works perfectly.
Code: Select all
LoadSprite(0,#ResPath + "\Eichung.png", #PB_Sprite_Texture)
Of course it's a workaround, because it uses the default transparancy color I guess, so I must be carefull not to have the same color in the image. Didn't check this out though.
Of couse having a mask would be nicer, so don't take it off the todo list for PB4.01

Posted: Mon Jun 26, 2006 1:38 pm
by Thalius
It's Color "0" from the Palette IIRC which is used as transparency Color.
Cheers,
Thalius
Posted: Mon Jun 26, 2006 6:06 pm
by Preludian
@Thalius: Sorry, I don't quite understand what you wrote, is it the same thing I wrote but in other words or am I missing something crucial.
To recapitulate, I have a png without mask, but I saved it with transparancy disabled and a black background instead in PS Save as Web.
Then I deleted the alpha part of the LoadSprite command, else the complete Sprite would have been transparent.
I guess I could have chosen any color as long as I set the TransparentSpriteColor accordingly.
What do you mean now???
EDIT: Ohoh, I didn't see the small black pixels around the sprites in 800x600, because of a dark background, but in Full Screen 1600x1200, yeiks, it's there

Was that what you wre trying to tell me Thalius?
Ok, then it's still a dirty bug. When does 4.01 come out????