Discuss Scratch

Photoguy77
Scratcher
100+ posts

Pen Color Block

So I know that the pen color block minimum value is zero, but what is the maximum value? Also, is the webcam input black and white? Thanks in advance.
ErnieParke
Scratcher
1000+ posts

Pen Color Block

The maximum color value is 199, though you can practically use any number. It just cycles around every 200. For example, 40=240=440=640=840=ect…

As for the webcam output, it's in color. Are you by chance getting black&white?

Asking,

ErnieParke

Last edited by ErnieParke (Oct. 25, 2013 23:50:18)

Photoguy77
Scratcher
100+ posts

Pen Color Block

No. I was thinking I could set pen size to .1 and move ever so slowly over the webcam output to take a picture. One more thing: I know that you can put a variable into the if touching color boolean. Does it use the same values as the pen color block?
ErnieParke
Scratcher
1000+ posts

Pen Color Block

Photoguy77 wrote:

No. I was thinking I could set pen size to .1 and move ever so slowly over the webcam output to take a picture. One more thing: I know that you can put a variable into the if touching color boolean. Does it use the same values as the pen color block?
No, it doesn't. It uses RGB colors like so:

256^2*(Red) + 256*(Green) + Blue

Unfortunately, it won't take 00FF00 or #00FF00 as an answer, but that's understandable.

Saying,

ErnieParke
Photoguy77
Scratcher
100+ posts

Pen Color Block

In that case could you give me a conversion list for pen block to rgb?
TFLegend
Scratcher
100+ posts

Pen Color Block

hi! can you guys tell my what pen is?
i mean like the easy bit im quite new
i played and made a few games on my old account like 2 years ago but ive forgoten all now XD
can you tell me the basics
i know most of all this but not pen
Photoguy77
Scratcher
100+ posts

Pen Color Block

Pen is a drawing tool in dscratch used in 3D games most of the time.
TFLegend
Scratcher
100+ posts

Pen Color Block

ohhhhhh. ok
thx
didnt really understand at first but i understand now ty

Last edited by TFLegend (Oct. 26, 2013 00:36:53)

Photoguy77
Scratcher
100+ posts

Pen Color Block

EDIT:Some non-3D projects use pen such as Artist 3.0.
TFLegend
Scratcher
100+ posts

Pen Color Block

dude, how exactly can you make 3D games???
Photoguy77
Scratcher
100+ posts

Pen Color Block

I do not know. All I know is that you usually use trigonometry. You might want to ask mikeono102.
TFLegend
Scratcher
100+ posts

Pen Color Block

ok thx i kinda knew itwas gonna be something quite hard if it was 3D XD
Photoguy77
Scratcher
100+ posts

Pen Color Block

Yeah. Why can't there be like a make 3D block or something?
TFLegend
Scratcher
100+ posts

Pen Color Block

true XD

if there was an easyer way for 3D to work why not do it

only way to do this

(whispers*)
RAGE!
ErnieParke
Scratcher
1000+ posts

Pen Color Block

@Photoguy77:
I could maybe make a block that would convert between the two, but I'd need how to convert between HSL colors (basically what the pen uses) and RGB, and so far I can't find anything on the subject other then some BASIC code. :/

Photoguy77 wrote:

Yeah. Why can't there be like a make 3D block or something?
That would be very inflexible if added. Really, you can't just say a magic word “3D!” and have Scratch turn into it. You need to understand a lot of math to do much of anything in the world of 3D, and then Scratch would have to have close to a complete overhaul to add it. Plus, there's always Alice and Unity 3D.

Saying,

ErnieParke

Last edited by ErnieParke (Oct. 26, 2013 17:31:24)

DadOfMrLog
Scratcher
1000+ posts

Pen Color Block

ErnieParke wrote:

@Photoguy77:
I could maybe make a block that would convert between the two, but I'd need how to convert between HSL colors (basically what the pen uses) and RGB, and so far I can't find anything on the subject other then some BASIC code. :/
This project provides custom blocks to set pen colour using HSB, including drop-in replacements for the built-in “set/change pen color” and “set/change pen shade”:
http://scratch.mit.edu/projects/12713728
i.e. it gives you control over pen saturation ('greyness').

I first put them together for the 3D pen rendering using in InterXeptor 3D, but only fairly recently remembered that I meant to make a stand-alone project out of them.

Also, just out of completeness, I included the off-edge-of-screen pen drawing in there too - providing custom blocks “set pen to X Y” and “draw to X Y” (for moving the pen to X,Y without drawing, and drawing a straight line to X,Y from wherever it was last placed with either of the two blocks), where X,Y can be off-screen without Scratch doing its usual trick of messing up the lines when they hit the edge. (Again, something I originally put together for the 3D rendering in InterXeptor.)

Oh, and yeah. @Photoguy77… 3D really does require lots of thought - even just working out how the gameplay should behave, never mind then actually scripting it all…
But I've tried to make a start towards some kind of 3D framework that may be just about usable for simple 3D games, and I'm hoping I can get back on with it soon (old home computer's not been able to cope that well with such complex projects as these, so had to stop trying to edit them on here…)

But see what you think so far…
Basic demo: http://scratch.mit.edu/projects/11471613 (and see the remixes)
More complex demo: http://scratch.mit.edu/projects/10143939

Enjoy!

Last edited by DadOfMrLog (Oct. 26, 2013 22:40:47)

DadOfMrLog
Scratcher
1000+ posts

Pen Color Block

Photoguy77 wrote:

No. I was thinking I could set pen size to .1 and move ever so slowly over the webcam output to take a picture. One more thing: I know that you can put a variable into the if touching color boolean. Does it use the same values as the pen color block?
Forgot to reply to this bit…

This project contains a custom block to ‘read’ a colour at a point:
http://scratch.mit.edu/projects/10941245
However, it has to check lots of colours before it finds a match, so it's quite slow - and it'll take an *extremely* long time to do it for lots of pixels - way too long to be practical for taking a snapshot from the webcam. And the ‘touching’ colour resolution is also a *lot* lower than the actual >16million colours avalable from 24-bit RGB (8 bit per component) - turns out ‘touching’ will match the colour components quite ‘loosely’ (read project notes for more details).

Also, there's likely to be another issue because of the way that ‘touching’ works with the pixels - it's kinda hard to explain, but the point that gets checked for a given X,Y isn't quite the same as the pixel at X,Y. It's sort of ‘offset’ in each direction, so it considers it is touching more than one pixel at a time - you can't actually scan the screen and find a specific pixel-by-pixel image…

All of above means you're not going to be able to do what you want (at least, not very accurately and not quickly - you might be able to take a very low-res very slow snapshot, I guess…)

Last edited by DadOfMrLog (Oct. 27, 2013 00:29:44)

ErnieParke
Scratcher
1000+ posts

Pen Color Block

DadOfMrLog wrote:

ErnieParke wrote:

@Photoguy77:
I could maybe make a block that would convert between the two, but I'd need how to convert between HSL colors (basically what the pen uses) and RGB, and so far I can't find anything on the subject other then some BASIC code. :/
This project provides custom blocks to set pen colour using HSB, including drop-in replacements for the built-in “set/change pen color” and “set/change pen shade”:
http://scratch.mit.edu/projects/12713728
i.e. it gives you control over pen saturation ('greyness').

I first put them together for the 3D pen rendering using in InterXeptor 3D, but only fairly recently remembered that I meant to make a stand-alone project out of them.

Also, just out of completeness, I included the off-edge-of-screen pen drawing in there too - providing custom blocks “set pen to X Y” and “draw to X Y” (for moving the pen to X,Y without drawing, and drawing a straight line to X,Y from wherever it was last placed with either of the two blocks), where X,Y can be off-screen without Scratch doing its usual trick of messing up the lines when they hit the edge. (Again, something I originally put together for the 3D rendering in InterXeptor.)
That line rendering code could be quite helpful to me because right now, I am working on Cut the Rope. I have a nice rope engine, graphics, and the such, but I need to figure out how I'll code the rope cutting part of the project. I've had a few ideas…

I'm also a bit glad about my previous estimates into the field on converting RGB, and it looks like what I had was correct. Did I have all of the chain? No, but what I did have I'm happy with its validity.

By the way, nice conversion project! I like how you used a variable to separate the important variables and the ones that can be “ignored”.

Nice,

ErnieParke
Photoguy77
Scratcher
100+ posts

Pen Color Block

Thank you for this and sorry for the late reply, I'll check it out!
oriscratch
Scratcher
3 posts

Pen Color Block

Photoguy77 wrote:

I do not know. All I know is that you usually use trigonometry. You might want to ask mikeono102.
Actually there is a way to make 3d without trigonometry or any other form of complex math, but it's really sloppy and doesn't really look like 3d.

Powered by DjangoBB