I need to make a game with terrains made of different "materials" (e.g, metal boxes, wooden boxes, etc). I need to make my main sprite be able to sense when he is touching the terrains, so he will "know" to stop if there is an obstacle in front of him.
The main problem is that the materials are going to be made of different colors, so I can't use the color sensor. Some help?
Offline
Maybe you could add a 1px border around them of the same color?
Offline
scimonster wrote:
Maybe you could add a 1px border around them of the same color?
No, I want it to look realistic. A green (or other color) line around everything will just make it look weird. (No offense intended.)
Offline
If every block is an object, the diffrent blocks could sense, wether they are touching a sensor (they'll be made invisible) and then broadcast which one they're touching. But this would mean maaany objects.
Else, the 4 sensors (invisible of course ;D) check if they are touching one of the blocks colors. If grass has diffrent green-tones choose one for the sensor, this will probably work! But if the same color appears in another block, this could be a prob so you've got to be careful.
Offline
xJira wrote:
If every block is an object, the diffrent blocks could sense, wether they are touching a sensor (they'll be made invisible) and then broadcast which one they're touching. But this would mean maaany objects.
Else, the 4 sensors (invisible of course ;D) check if they are touching one of the blocks colors. If grass has diffrent green-tones choose one for the sensor, this will probably work! But if the same color appears in another block, this could be a prob so you've got to be careful.
I don't understand what you mean. It sounds very professional.
Could you explain?
Offline
Rather than have one sensor colour you could just have the sensing sprite look for the colour that's on the outside of the terrains, and If they all react the same just use an and, else just have the individual scripts.
Offline