I'm trying to generate a realistic night-time shadow and terminator using the pen, drawing on top of a stamped spherical Earth. (I don't mind for now that the day side of the Earth is evenly illuminated)
The code had some rendering artifacts which were fixed by @Istrali2 (Also thanks to @chooper100 for pointing us in the right direction) It works by using pythagoras to determine the longitude of the terminator for each latitude, plus the longitude of +2, +4, +6 etc degrees trailing the terminator. Those pixels are drawn in lighter shades (taken from a lookup table to manually compensate for non-linearity of shading values) If the X positions of successive longitudes reverse direction then we assume we have gone past the edge to the far side of the planet and we stop drawing them. There appear to be some drawing artifacts because I can see a dark edge to each of the terminator bands. I'm afraid I always find pixel-perfect drawing with the pen on Scratch to be rather difficult.