Hi All,
I need help with a method which finds the nearest point to an actor where a color is.
It should work like getObjectsInRange or something like that. Just with colors instead of Actors.
Any ideas?
A method like that would probably take up way too much CPU time and slow down your scenario. Also, it would be a very complicated method to write. It would be even more complicated if the color could be from another actor as well as from the world. I was thinking about creating actors for each possible point that could be found; but, even that would require a multitude of transparent pixel-sized actors. These actors, however, could be rotated to indicate the slope of the edge at that point (I noticed you were looking at the 'Gravity Engine' scenario). You could then use 'getObjectsInRange' with an increasing range to find the closest point in question. As an added benefit, you can use the rotation of that point to aid in determination of a new direction (twice the rotation of point minus rotation of this would be the new rotation of this for a standard bounce).