Discuss Scratch

123789456000
Scratcher
66 posts

New block, about colours!

123789456000 wrote:

Well, I want it to REPORT a VALUE as an RGB colour. The
<touching color [#ff0000] ?>

block only detects 1 colour. (bright red).


And it would report the colour number the center of the sprite is touching.

Last edited by 123789456000 (March 23, 2015 17:21:33)

-Glacier-
Scratcher
35 posts

New block, about colours!

Yes they should add a what color this sprite is touching. There is a way to do this but it is a big script.

123789456000
Scratcher
66 posts

New block, about colours!

Well, it would then proceed… to…… errrrr………….. you ask me difficult questions!!!
123789456000
Scratcher
66 posts

New block, about colours!

-Glacier- wrote:

Yes they should add a what color this sprite is touching. There is a way to do this but it is a big script.


Yeah. I tried it myself.
IronBit_Studios
Scratcher
1000+ posts

New block, about colours!

123789456000 wrote:

Well, it would then proceed… to…… errrrr………….. you ask me difficult questions!!!
Use quotes, like this. BTW, I agree with Hockeyist
123789456000
Scratcher
66 posts

New block, about colours!

TheHockeyist wrote:

123789456000 wrote:

Well, I want it to REPORT a VALUE as an Rgb colour. The
<touching color [#ff0000] ?>

block only detects 1 colour.


And it would report the colour number the center of the sprite is touching.

What if the center touches multiple pixels, e.g. a 2x2 sprite?

IronBit_Studios wrote:

123789456000 wrote:

Well, it would then proceed… to…… errrrr………….. you ask me difficult questions!!!
Use quotes, like this. BTW, I agree with Hockeyist


Ok, then

TheHockeyist wrote:

123789456000 wrote:

Well, I want it to REPORT a VALUE as an Rgb colour. The
<touching color [#ff0000] ?>

block only detects 1 colour.


And it would report the colour number the center of the sprite is touching.

What if the center touches multiple pixels, e.g. a 2x2 sprite?

I agree with Hockeyist.

Last edited by 123789456000 (March 23, 2015 17:47:51)

stickfiregames
Scratcher
1000+ posts

New block, about colours!

Support for
(color at x: () y: () :: sensing)
(color at [sprite v] :: sensing)
To answer TheHockeyist's question, the second one would use the colour at the x and y position of the sprite as listed at the top right of the scripts pane (which seems to be the same as the floor of the sprite's exact x and y position). Also, it would ignore the colour of the sprite itself since it would be quite useless otherwise.
Rex208
Scratcher
500+ posts

New block, about colours!

kvackkvack wrote:

I do not support this, but rather this block:
color at x: () y: () :: sensing
// To check what color the sprite is touching, all you now have to do is this:
color at x: (x position :: motion) y: (y position :: motion) :: sensing
Cyoce
Scratcher
500+ posts

New block, about colours!

kvackkvack wrote:

I do not support this, but rather this block:
(color of x: () y: () :: sensing)
// To check what color the sprite is touching, all you now have to do is this:
(color of x: (x position :: motion) y: (y position :: motion) :: sensing)
Support for this (I edited the Scratchblocks to make it into reporters, and changed it to “color of”).
It would report what color the specified coordinate (basically pixel) is.
One problem, though: how will it report a color? There currently isn’t a color data type/slot, and I don’t see how we could use it. Personally, I would prefer a hexadecimal RGB string.
stickfiregames
Scratcher
1000+ posts

New block, about colours!

Cyoce wrote:

kvackkvack wrote:

I do not support this, but rather this block:
(color of x: () y: () :: sensing)
// To check what color the sprite is touching, all you now have to do is this:
(color of x: (x position :: motion) y: (y position :: motion) :: sensing)
Support for this (I edited the Scratchblocks to make it into reporters, and changed it to “color of”).
It would report what color the specified coordinate (basically pixel) is.
One problem, though: how will it report a color? There currently isn’t a color data type/slot, and I don’t see how we could use it. Personally, I would prefer a hexadecimal RGB string.
A number would be more useful, since it could be dropped into a colour slot.
(If you don't know, you can put numbers into a colour slot in either decimal or hex if you put a reporter in the slot, like this:
set pen color to ((16777215) + (0))

set pen color to (join [0x] [ffffff])
Returning it as a hex string like 0xffffff would also make it possible to put in a colour slot, but I think it would probably just be a number.
Cyoce
Scratcher
500+ posts

New block, about colours!

stickfiregames wrote:

A number would be more useful, since it could be dropped into a colour slot.
(If you don't know, you can put numbers into a colour slot in either decimal or hex if you put a reporter in the slot, like this:
set pen color to ((16777215) + (0))

set pen color to (join [0x] [ffffff])
Returning it as a hex string like 0xffffff would also make it possible to put in a colour slot, but I think it would probably just be a number.
Now that I think about it, a number would probably be best, as it would be easier to modify the individual color values than base-16 hexadecimal.

Last edited by Cyoce (March 24, 2015 01:50:18)

ev3commander
Scratcher
500+ posts

New block, about colours!

No support. What if a sprite was sandwiched between 0xFF0000 and 0x00FF00, what would it report? Exactly. So we should not have this block but rather kvackkvack's block.
123789456000
Scratcher
66 posts

New block, about colours!

Ok. I would really like to have this block:

colour at x:() y:() ::sensing

But as a reporter. You know, blue variable shaped like this:

(answer)

Thanks for the suggestion, kvackkvack!!! :- )
kvackkvack
Scratcher
500+ posts

New block, about colours!

123789456000 wrote:

Ok. I would really like to have this block:

colour at x:() y:() ::sensing

But as a reporter. You know, blue variable shaped like this:

(answer)

Thanks for the suggestion, kvackkvack!!! :- )
You're welcome!
And you're right, it should be a reporter - I was quite tired when I made that comment
color at x: () y: () :: sensing reporter
123789456000
Scratcher
66 posts

New block, about colours!

Moving on from Scratch? Don't learn Java or a C-derivative; that's like going to Moon with only the engine of your spaceship. Instead, learn some simpler language like JavaScript or Processing.

I know Assembler:
This is how to print “hello world”:

section .text
global _start ;must be declared for linker (ld)

_start: ;tell linker entry point

mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel

mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel

section .data

msg db ‘Hello, world!’,0xa ;our dear string
len equ $ - msg ;length of our dear string


123789456000
Scratcher
66 posts

New block, about colours!

To be MORE detailed:~

colour at x: () y: ()  ::sensing reporter

And it would report a 256-bit RGB number.

DONE!!
cwrivera99
Scratcher
500+ posts

New block, about colours!

kvackkvack wrote:

I do not support this, but rather this block:
(color of x: () y: () :: sensing)
// To check what color the sprite is touching, all you now have to do is this:
(color of x: (x position :: motion) y: (y position :: motion) :: sensing)

Cyoce wrote:

stickfiregames wrote:

A number would be more useful, since it could be dropped into a colour slot.
(If you don't know, you can put numbers into a colour slot in either decimal or hex if you put a reporter in the slot, like this:
set pen color to ((16777215) + (0))

set pen color to (join [0x] [ffffff])
Returning it as a hex string like 0xffffff would also make it possible to put in a colour slot, but I think it would probably just be a number.
Now that I think about it, a number would probably be best, as it would be easier to modify the individual color values than base-16 hexadecimal.
Support for these two.
cwkethan1508
Scratcher
100+ posts

New block, about colours!

No support

if <touching color [#ff0088] ?> then
do stuff :: motion
end
IronBit_Studios
Scratcher
1000+ posts

New block, about colours!

cwkethan1508 wrote:

No support

if <touching color [#ff0088] ?> then
do stuff :: motion
end
Why? Please don't necropost and go off topic, as well.
dude341
Scratcher
1000+ posts

New block, about colours!

cwkethan1508 wrote:

No support

if <touching color [#ff0088] ?> then
do stuff :: motion
end
The block he's suggesting is nothing like that. It detects what colour they're touching.

Powered by DjangoBB