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 Collision?

Author
Message
Snafu
20
Years of Service
User Offline
Joined: 25th Jun 2003
Location:
Posted: 26th Jun 2003 17:44
Just wondering if this is possible:-

Detecting Sprite collision only with parts that are not transparent.

i.e my colorkey is 255,0,255

I've got a 640x480 image on screen, and I just want to check collision against the parts that dont match 255,0,255 ?

- Steve
warzog
21
Years of Service
User Offline
Joined: 13th Oct 2002
Location: United States
Posted: 26th Jun 2003 18:12
Not yet.
S'posed to be one of the many 2D fixes in the 5.0 patch.
Snafu
20
Years of Service
User Offline
Joined: 25th Jun 2003
Location:
Posted: 26th Jun 2003 18:33
Just been reading through the forums, and it would seem that it is indeed possible, IanM has posted code, however it looks to be incomplete, possibly due to an error somewhere?

I'm not sure if I'm the only one with this problem, as I only signed up to the forums a few days ago.. been lurking a while though.. but there are a fair few instances of people saying "Here's the code!" and then nothing afterwards....

- Steve

Kanzure
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location:
Posted: 26th Jun 2003 18:37
Load all the parts that are transparent, and all the parts that aren't, into an array, then check against the array when your sprite comes up to that section @_@.

Daunting, but thats the only way I know of at the moment.

~Morph
Owner of MultiCode.NET and Multi2k.NET.
Nothing is something, and something is then nothing. Life is an illusion.
Snafu
20
Years of Service
User Offline
Joined: 25th Jun 2003
Location:
Posted: 26th Jun 2003 18:42
Any examples?

There is most certainly another way which IanM posted as I said, I just can't see the whole code...

- Steve

Kanzure
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location:
Posted: 26th Jun 2003 19:19
No. You have to make the array by HAND...Or write a DB program to scan it (the image), which is also tough.

~Morph
Owner of MultiCode.NET and Multi2k.NET.
Nothing is something, and something is then nothing. Life is an illusion.
Snafu
20
Years of Service
User Offline
Joined: 25th Jun 2003
Location:
Posted: 26th Jun 2003 20:03
I'm also very dumb. Didn't see the rather obvious "Source" button until now...

I'll do it the old fashioned way, read source, understand source, re-write source...

- Steve

Nilrem
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United Kingdom
Posted: 27th Jun 2003 02:34
Snafu it does work.

Try the below code that utilises IanM's code.

I hear and I forget. I see and I remember. I do and I understand.
Kango
20
Years of Service
User Offline
Joined: 27th Jun 2003
Location:
Posted: 27th Jun 2003 23:57
How do u Even Put on Sprites? :-s

Kango
20
Years of Service
User Offline
Joined: 27th Jun 2003
Location:
Posted: 27th Jun 2003 23:58
?:S= :-s

Kango
20
Years of Service
User Offline
Joined: 27th Jun 2003
Location:
Posted: 28th Jun 2003 00:00
:-s= :-s

Megaman X Gold
20
Years of Service
User Offline
Joined: 29th Jun 2003
Location: Canada
Posted: 30th Jun 2003 18:20
Can someone explain to me how that code actually sets the transparent color to not act as part of the sprite in a collision?

I really didn't expect that transparencies would count in collisions because that's automatically taken care of in something as shitty as Macromedia Director's "Lingo" programming language, so I had just assumed it would've been taken care of in this. I went and tested it in disbelief and found that transparencies do count in collision.

I was really disappointed and now I'd like to see a simple quickie guide on what exactly makes that script tick. I want to edit it to conform with my code for my game engine, and I can't do that because I just have no clue how it works.

Thank you all much teh much. ^-^
Cya.

Life is more like a box of Grenades. Throw the pin instead of the grenade, and it blows up in your face...along with the rest still beside you.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Jun 2003 22:41
What is it you are after exactly? I have several sprite collision routines, depending on what is required.

The usual one wanted is alpha collision. The one Nilrem has posted is for non-black colours.
Megaman X Gold
20
Years of Service
User Offline
Joined: 29th Jun 2003
Location: Canada
Posted: 1st Jul 2003 02:11
I would like one that takes anything made by DBPro to be see-through to not count as a collision.

Life is more like a box of Grenades. Throw the pin instead of the grenade, and it blows up in your face...along with the rest still beside you.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st Jul 2003 02:22
So, anything with an alpha value of zero? - Attached.

Or do you mean with a transparency set with 'SET IMAGE COLORKEY'? That's a little harder, but do-able.
Megaman X Gold
20
Years of Service
User Offline
Joined: 29th Jun 2003
Location: Canada
Posted: 1st Jul 2003 23:47 Edited at: 1st Jul 2003 23:47
I don't have the slightest clue how that code works...and whatever the heck it's doing, all it's managing to do is make the thing crash.

Is there something I should know or change about this code??

(btw, "anything with an alpha value of zero" is what I wanted)

Life is more like a box of Grenades. Throw the pin instead of the grenade, and it blows up in your face...along with the rest still beside you.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 2nd Jul 2003 22:34
Oops, I forgot to mention that the code will only deal with 32 bit images. That may cause a crash when the code tries to read into memory it doesn't own.

Login to post a reply

Server time is: 2024-04-20 08:47:26
Your offset time is: 2024-04-20 08:47:26