## Discuss Scratch

PiBros-314
Scratcher
17 posts

### A Cloning Question

I am going to make a minesweeper-like game, and I was wondering whether, to program in all of the squares, I could use a cloning trick.

Thanks!

PiBros-314
KingOfAwesome58219
Scratcher
1000+ posts

### A Cloning Question

Yes!
You could do this a manner of ways. I think the easiest is to just move a sprite along each row, and clone every <square diameter> steps, like so:
`set [cloneID v] to (0) // how you identify each individual clone, in this sprite onlygo to x: (-70) y: (70) // (-80, 80) + the radius so they are centeredrepeat (8) // 8x8 square i'm making here, minesweeper blocks are 20x20repeat (8)create clone of [myself v]change x by (20)change [cloneID v] by (1)endchange y by (-20)set x to (-70)end`

PiBros-314
Scratcher
17 posts

### A Cloning Question

KingOfAwesome58219 wrote:

Yes!
You could do this a manner of ways. I think the easiest is to just move a sprite along each row, and clone every <square diameter> steps, like so:
`set [cloneID v] to (0) // how you identify each individual clone, in this sprite onlygo to x: (-70) y: (70) // (-80, 80) + the radius so they are centeredrepeat (8) // 8x8 square i'm making here, minesweeper blocks are 20x20repeat (8)create clone of [myself v]change x by (20)change [cloneID v] by (1)endchange y by (-20)set x to (-70)end`

Okay, I've encountered a problem I forgot about, which makes it almost impossible to create a 20x20 minesweeper board with clones.

20 x 20 = 400.

You aren't allowed to have 400 clones.

Any solutions to this? I have one where, maybe you could use a abnormally large list to do it. I think this might be possible because i've
A. Seen a platformer made out of lists
B. I've seen minesweeper made on a graphing calculator.

And while we are at it, is there a way in which you don't need a ID variable for each clone?

Thanks!

Last edited by PiBros-314 (Dec. 10, 2017 20:04:31)

PiBros-314