Standard color for painting and collision detection

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:

  1. 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.
  2. 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!

Hi!

Perhaps what you want is the Crayons library, which provides a palette of 100 colors in 10 color families, so, 10 shades of red. The pure spectral member of each family is included, so you can have 0xff0000 if you want.

Thanks for the reply. I guess I should use a script to specific shade of red and then draw this is a circle on the background? I am unable to use motion blocks on the background and the pen palette does not have Pen Down to start drawing. Any advice?

Right, the background occupies the entire area of the stage and therefore can't move around. Only sprites can move and draw, but they draw onto the background. So just have a sprite do it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.