Overlay collision

Started by Cino, Tue 19/02/2008 21:40:35

Previous topic - Next topic

Cino

I wanted a pixel perfect collision detection for overlays, so after thinking about it a bit, the only solution I could come up with was that I create create an object off screen or in the same position with the same sprite and use the Object.GetAtScreenXY function on every pixel. Is there a better solution or will this have to do? If I'm not mistaken, you can move/change an object only once per a call of repeatedly_execute, so I would have to make one object for every overlay I have, but since I switched from objects to overlays because of the limit of 50 objects+characters per screen, that would make the change pointless.
Would be nice to have a DrawingSurface.GetPixel function, that'd make something like this a whole lot easier. Though I'm aware it's in the tracker.

Pumaman

DrawingSurface.GetPixel is by far the easiest solution to this, and it's on my list.

Cino

I guess I'll have to wait for it then and use a non pixel perfect collision detection meanwhile.

deltamatrix

Thats interesting.

Will that return a Pixel* object or something? and will it support alpha channel?

A SetPixel would be cool for manipulation of images.
BAD WOLF - TORCHWOOD - MR SAXON - THE BEES ARE DISAPPEARING - PANDORICA - RIVER SONG

GarageGothic

#4
Quote from: deltamatrix on Thu 21/02/2008 15:50:15
Thats interesting.

Will that return a Pixel* object or something? and will it support alpha channel?

A SetPixel would be cool for manipulation of images.

You already have a SetPixel function in the form of DrawingSurface.DrawPixel. I'm guessing that DrawingSurface.GetPixel(int x, int y) would return the color number of the pixel. A separate Pixel class doesn't seem very useful since it's so limited what you can do with it (get/set), and you'd have to renew the pointer a bunch of times just to edit a small part of an image.

deltamatrix

I was thinking it could be possible to run shader-like and manipulation filters on any DrawingSurface using both SetPixel() and DrawPixel().

I may see if its possible to gradually blur the background using a convolution kernel. I haven't given it much thought but it might be a slight challenge considering the RGB channels are not separated.
BAD WOLF - TORCHWOOD - MR SAXON - THE BEES ARE DISAPPEARING - PANDORICA - RIVER SONG

SMF spam blocked by CleanTalk