How to sense collision with a color
Closest you can do is the âRead Pixelsâ Extension. Outside of that, there isnât any native detection of colors at all (unless youâve tinted something), much less collision.
I tried to use that but couldnt figure out how to use that . Can u share a example or tell me
As I said, the closest you could do is that extension. It wonât replicate âIâm detecting if this object is colliding with a colorâ
All it can do is âIs this x/y location a specific colorâ.
Canât really give a tutorial beyond that, sorry.
Isnt there an example of this extension?
If you would like to compare the colors of objects and not individual pixels, an other way to go about this is to store the color of each object inside an object variable as a text for example âredâ âgreenâ âyellowâ, or the actual RGB value even â255;123;117â and when the object collide, you can compare the values to check what color it is.
However, if you would like to compare color of instances of the same object that could be a problem, GDevelop does not support comparing instances of same object out of the box. If thatâs the case, you can find lots of topics on the forum about how to check collision between instances of the same object.