This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-06-27 03:59:30

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

3X3 Grid

I need help! And it seems pretty advanced! How can i get a simple script to check a 3X3 area for 5 different colors? Right now, I have a REALLY long script which moves and than checks. Is there an easier way (I use the stamp function and a sensor)?

O.K., I'll go put it in AAS too
And than it keeps checking until it can't find any of the same colors (if you can)

Last edited by Bluestribute (2008-06-27 04:04:54)


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#2 2008-06-27 05:52:33

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: 3X3 Grid

This must be more work on the Virtual Rubics Cube?  Can you describe the problem in more detail?  You want to know if a particular color is in the grid?


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2008-06-27 10:02:06

chalkmarrow
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: 3X3 Grid

I agree with Paddle2See re getting more info, but if you're checking for colors in a 3x3 area, i would just have nine simple sensors, all staying a certain position relative to the central sensor, where each sensor simply keeps checking to see what color it's touching (and assigning that to a number 1-5). Sometimes its easier to do stuff in parallel with many sprites, since that is something scratch is really good at.

Offline

 

#4 2008-06-27 13:37:17

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: 3X3 Grid

O.k.:

I have the entire screen filled wit different colors (using the stamp function). When you click one, a sensor comes. It will check to see how many of the same colored objects are around it.


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#5 2008-06-27 15:29:28

bigB
Scratcher
Registered: 2007-06-09
Posts: 100+

Re: 3X3 Grid

i did something similar in my minesweeper game.
I used a sprite with eight dots in a square so one goes on each of the sqaures around it. 
Each dot is a different colour.
I have a variable called neighbours.
I then have a checking process like this:
if colour1 over (whatever colour), change neighbours by 1
etc x 8
After this you use the variable neighbours to say how many neighbours have the same colour.
Its quite a long script i know but it works.


http://scratch.mit.edu/projects/bigB/260981 Draw to Text
http://scratch.mit.edu/projects/bigB/181829 3D Stunt Flyer

Offline

 

#6 2008-06-27 15:30:48

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: 3X3 Grid

bigB wrote:

i did something similar in my minesweeper game.
I used a sprite with eight dots in a square so one goes on each of the sqaures around it. 
Each dot is a different colour.
I have a variable called neighbours.
I then have a checking process like this:
if colour1 over (whatever colour), change neighbours by 1
etc x 8
After this you use the variable neighbours to say how many neighbours have the same colour.
Its quite a long script i know but it works.

Hmmm.... I kinda get it! I'll try and see if I can use it by just reading this, otherwise I'll see your scripts.
I just realized I have soemhing like that. It changes it's X until the variable check doesn't equal the color, than it goes down. It's just so hard though!

Last edited by Bluestribute (2008-06-27 15:31:26)


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#7 2008-06-27 16:23:12

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: 3X3 Grid

I don't get it


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

Board footer