Skip to first unread message

Johan Schaep

unread,
Nov 17, 2019, 12:00:26 PM11/17/19
to MIT App Inventor Forum

I am looking at the scratchcard solution and when ‘playing’ with the blocks there is one thing I still do not understand.

Color of the canvas layer above the picture is white (255-255-255) and by scratching you remove this white canvas color layer based on the fourth component of the white color which is set to 0.

I just don’t understand why it doesn’t work with another color e.g. red layer and setting the canvas color to scratch at 255-0-0 should work (analogous to the solution with white) but it doesn’t.

For me this is not logic.

Hope you can clarify!

TimAI2

unread,
Nov 17, 2019, 2:04:35 PM11/17/19
to MIT App Inventor Forum
A link to the "scratchcard solution" might help ?

SteveJG

unread,
Nov 17, 2019, 2:20:49 PM11/17/19
to MIT App Inventor Forum
Is Taifun's mini tutorial Scratch card what you are asking about Johan?  How to create a Scratchcard with App Inventor

The fourth 'color' 0 means the 'color' is set to transparent.

Colors are built  like this http://appinventor.mit.edu/explore/ai2/support/blocks/colors     If you add a fourth parameter, it controls the transparency.

Regards,
Steve

Johan Schaep

unread,
Nov 18, 2019, 1:29:15 PM11/18/19
to MIT App Inventor Forum
Right SteveJG. But try this solution for another color and it doesn't work, which I don't understand. In other words: how to make a scratchcard in a colour different from white?

@TimAI2: the link is indeed the link that SteveJG has given:


SteveJG

unread,
Nov 18, 2019, 1:48:24 PM11/18/19
to MIT App Inventor Forum
Is this what you mean?

zzzScratchColor.PNG

You want to change the Canvas.Background color.  This works.   Sorry, I do not understand your description about what you think should happen, but does not.  Why not provide an example Johan?   Show an image of the Blocks you tried.

Regards,
Steve

Johan Schaep

unread,
Nov 19, 2019, 1:34:38 PM11/19/19
to MIT App Inventor Forum
OK Steve, many thanks. And sorry but not used to be on forums...
Your solution works:

ScratchcardOK.JPG


I was thinking in a too difficult way, although I still don't understand why the solution below does not work. I try to understand too much...

Scratchcard.JPG


Reply all
Reply to author
Forward
0 new messages