Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Connect Four Help?
- Coding_Boy
- Scratcher
26 posts
Connect Four Help?
I'm working on a Connect Four game, but the piece glitches out and adds a piece to every column instead of only adding one. I have a list for each column (column1, column2, etc.) and adds 1 (for red piece) to the corresponding column.
define Drop Piece in (column)
if <(column) = (column1 :: list)> then // This code by itself works, just not with the other rows.
set y to (60)
repeat ((5) - (length of (column1)))
change y by (-42) // Move one slot.
end
add (costume #) to [column1 v]
end
when green flag clicked
forever
if <<(column#) = [1]> and <(length of (column1)) < [6]>> then
Drop Piece in (column1)
- Atusiff
- Scratcher
100+ posts
Connect Four Help?
define piece in (column)
set x to (round ((column) / (42)) * (42)
hi! i'm atusiff – have a great day!
- deck26
- Scratcher
1000+ posts
Connect Four Help?
Unless you've hacked the blocks you can't pass a list to a custom block. Why not just use the column# variable as the parameter for the custom block?
- Discussion Forums
- » Help with Scripts
- » Connect Four Help?