I want to create a simple color-based collision detection system for a flight game for my kids. The idea is that if the airplane sprite touches a certain color of the background, it broadcasts a message (game over if black, goal achieved if red).
I painted a red circle using the color picker on the background and implemented an IF TOUCHING block for the sprite and chose a red color using the color picker.
The problem is that these two shades of red are not the same, so the IF TOUCHING block never returns true.
I found a work-around. When picking the color for the IF TOUCHING block, you can actually move the pointer away from the color picker to the background thumbnail in the top right corner and pick the exact shade from there. This works if this is the only background in the game.
But now we want to create another background as level 2, etc. I can again paint the red target for level 2, but now I cannot see an easy way to pick exactly the same shade of red as the first background.
Again, there are work-arounds:
- Add an OR block to the IF TOUCHING block, and rewrite it as “if touch [red from level] 1 or [red from level 2]” ,but this will not scale well.
- create a background template that already has all the relevant colors in it, and then I create new background levels from that template.
But it seems to me that Snap may also just have a limited palette of colors to choose from for kids. Or Snap may have a way to 1) pick a color from the color picker using the RGB color code, and then use the same RGB color code in the IF TOUCHING block.
I hope you can help with an easy solution for kids to understand!
Thanks in advance!