As far as I can work out, the only way a sprite can detect a colour it is touching is if it has a copy of that colour in a <touching color[ ]> block. so if it is not touching any colors it can refrence against stored colours in it's script, it can't tell what colour it is touching.
can anyone suggest a way around this, for something like the eyedropper in the sprite drawer.
ta
Offline
Nope, it could be nice. Be the first kid on your block to have a Scratch drawing app with 16 million colors!! Lol. Ok, I don't really mean that. Sure you can have over 16 million colors if you want but I will never assume that I'm doing anything on Scratch for the first time ever. This will be an extremely simplified way of explaining this and it still might sound confusing. Yes, it is true that Scratch doesn't have a color reading function per say, you can fake it and get the same results with x and y variables and the List function.
I first came up with this idea and it was used for a Color Picker by darkstar800 here...
http://scratch.mit.edu/projects/darkstar800/735680
Awesome eh? He did the all the hard work, I just contributed the idea.
It works by reading the mouse icons x and y position and then mathematically figuring the color based on that. To the user, it appears as though it is reading the colors below the cursor but actually it just reads where the cursor is when they click the mouse button.
After reading your post, I was about to give up on an eyedropper feature then I realized it is completely possible! Use a similar system. Lets say the user draws an X colored line from point A to point D. The application would need to record the color used (X) for every pixel (X,Y location) that is drawn over into a List. The eyedropper works much like our color picker. It would use the x,y position to read the color stored for that x,y location from the List. Now, if your program uses pen sizes larger than 1, you will have to figure out a formula that writes the data to the necessary x,y positions around the current x,y location based on the current pen size. Similarly, using shade functions would require extra saved information instead of just the color used, etc. etc.
Wow, did any of that make sense? Trust me, it will work. The most obvious drawback to me seems to be how fast Scratch can write the List(s) data without significantly slowing down the draw speed. Especially with larger pen sizes. But at any rate, have fun and never ever ever accept that something can't be done. I mean, no one has sailed off the edge of the world yet, right? >=P Peace.
Last edited by Locomule (2009-11-09 02:33:43)
Offline
I could add that to streak... but then it would require a whole new variable type. And, as elementary as it sounds, I am even having trouble implementing boolean variables. Or, I could do a sensing block that gives, say, the HSB values like this:
100:020:056
. This could then be parsed with the substring block, so as (substring 1 to 3 in '100:020:056') would give the hue, etc.
But, then we run into the issue of different values used in pen colours and image effects.
Since image effects can have negatives, and obviously we can't have variable number lengths (because that would break the substring method), all channels of sensed colours must have an ordinal (- if it is negative; if positive, + as a placeholder). But not, positive numbers register as strings, not numbers.
All these complexities...
Any feedback/ideas?
Offline
What/where is "streak"? I looked in your gallery but saw nothing called that.
And booleans variables are cool but is there a specific reason why you want to use them instead of lists?
But as far as booleans go...
For negative values, don't store them as negatives. First add value X to them (where X is a number high enough to raise negatives to positives) and then when the values are parsed subtract X to restore their initial negative value.
Or... use ordinals in your boolean variable so if you had 3 substrings (hue/color/shade) just add your ordinal for each substring before it using 000 for positive and 111 for negative...
Thus the 3 substring variable (-100:020:-056) becomes the six substring variable (111:100:000:020:111:056) Of course each integer would have to be examined independently to determine its ordinate and then converted to its absolute value before being stored, with this process reversed as they are parsed. But I bet you already figured that out.
I've never used boolean variables so thanks a lot for teaching me something. Hope I figured it out enough to be helpful. This also expounds on a question I posted a while ago about how to do arrays. Peace.
Offline
Hexadecimal color coding would be more useful! My idea is that you can type in a value such as #FFCC00 or a color such as orange.
Nobody wrote:
I think we should make games that allow that with 1 script or so. We could make an ask statement and have 256 if statements following that!
I agree with Nobody!
Offline
UGWG wrote:
Hexadecimal color coding would be more useful! My idea is that you can type in a value such as #FFCC00 or a color such as orange.
You would have to have a system to convert multiple values (the color, brightness, etc) into a single color (or hex value)
Offline