Can it be done using no javascript, just the Snap! primitive blocks, now?

Path Following Robot with two sensors, each of them detecting presence of specified R or G or B color values within 3x3 pixels around center of the sensor.

It was made in 2016, with help from users on Snap! user discussion back at the old Scratch forum - at the time no Snap! forums existed yet - when I tinkered together some JS.

I'd like to embed it here, but it needs to be opened in editor mode as javascript needs to be enabled before you run the project. So, I wonder if it can be done using no javascript, just the Snap! primitive blocks?

= = =

*details*

On the left, a) printscreen of the 2016 discussion at Scratch forum and b) javascript used, on the right.

If I understand correctly, there is a primitive for detecting RGBA: untitled script pic (7)

Thank you, joecooldoo, you are right.

I wonder if it will be as fast as was the js version. I also wonder if checking the 3*3 pixels could be somehow hyperized, so that it would check all the 9 pixels without having to use a loop? Any idea?

Maybe convert the list into a 480 by 360 list (size of the stage) and write a check that finds the current pixel your looking for and look at the columns around the one pixel. Wait, I might find something even faster than the primitive I recommended.

What about using paste on block that would paste the Path sprite on the Sensor sprite, and then maybe using keep items block to check if pasted-on pixels list contains certain R values?

What do you think?

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