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.

2D All the way! / Sprite Hit () = 1 when bounding boxes collide

Author
Message
They Killed Kenny
20
Years of Service
User Offline
Joined: 18th Jul 2004
Location: FL, USA
Posted: 4th Apr 2005 11:19
Every Time I try ti use Sprite Hit, It returns a one when the bounding boxes collide. I haev the Beginner's Guide To DarkBasic, and it says that It's supposed to get the actual pixels and check if they collide, ignoring the transparent pixels' collisions.

I saw some old posts saying that an update was coming, but that was over two years ago... I updated my DBPro and it still won't work. I don't want to have to use one of those complicated fnctions, so can anyone help me?

Stan: OH MY GOD! THEY KILLED KENNY
Stan's Grandpa: You Bastards!
Kyle: HEY! ><
D Ogre
21
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 5th Apr 2005 04:49 Edited at: 5th Apr 2005 04:53
This has been an ongoing problem with DarkBASIC Professional. There have been many posts concerning the collision for 2D since DBpros first release. I believe there was going to be a fix for it, but I'm not sure if or when it will be implimented. I think their is an actual plugin upgrade for it, for a fee of course. As far as the book saying that the collsion works, if its the same book I'm thinking of, that book was written in regards to DBC and not DBPro.

If you search the CodeBase, there are several functions written in DBPro that might help you. I've used the one written by IanM (SpritePixelCollision). The function works fairly well and it seems to be pretty fast, at least for me it was.

I hope this helps you.
They Killed Kenny
20
Years of Service
User Offline
Joined: 18th Jul 2004
Location: FL, USA
Posted: 5th Apr 2005 08:40 Edited at: 5th Apr 2005 10:43
Thanks, I'll try just sticking it in my code and seeing if thats all i have to do . I hope it wont be too hard to understand...

I'll repost if I have problems.

EDIT:
whoah, I don't get a single line of this stuff.I think ill just stick it on the bottom of the program and replace spritehit with spritepixelcollision ().

EDIT2: I had a problem . I inserted that into the code, and the Main Player (A green Circle for now) got lodged inside the ground o-o. The second time, it went right on through. Is this code stable?

here is all of my code:

(only the gravity is done)


Is this the one that required Alpha Channel?

Stan: OH MY GOD! THEY KILLED KENNY
Stan's Grandpa: You Bastards!
Kyle: HEY! ><
They Killed Kenny
20
Years of Service
User Offline
Joined: 18th Jul 2004
Location: FL, USA
Posted: 5th Apr 2005 11:16 Edited at: 6th Apr 2005 08:00
Fixed it, It was the whole Alpha/PNG thing. Thanks for the help.


Edit: Does Anyone else get a strange semi-translucent line drawn at the bordes of your PNG sprites? Mine have an odd line at the top, and its barely there... all my programs can't delete it, so I'm Thinking its a Dark Basic Bug...

Stan: OH MY GOD! THEY KILLED KENNY
Stan's Grandpa: You Bastards!
Kyle: HEY! ><

Login to post a reply

Server time is: 2025-05-17 16:47:13
Your offset time is: 2025-05-17 16:47:13