Same Game Test 14
This is a test for a game that's the same as Same Game except it's in Scratch.
Kuniaki Moribe gets credit for the original same game called "Chain Shot!"
HOW TO PLAY:
Click a color that's neighboring another color.
Wait a while before you can click another.
HOW I MADE IT:
This is growing on the cursor and grid/cell techniques I learned from making the “Gui combo box” and the “Conway's Game of Life”. It also borrows somewhat from the drawing array technique. (I'm not sure who started that.)
Initially the level was created by one sprite, a cell at a time. but is was slow.
So I finally narrowed it down to each column having a sprite that handles it's column for drawing and everything else:
1. “DrawNewGame” draws the random colored balls in the column starting from the bottom.
2. “MarkConnectedBalls” starting at a region around the cursor. it senses whether one of it's neighbors has a “MarkEmpty” dark grey color. if it does, it also stamps “MarkEmpty”. and continues. several time in this region that expands. This part needs more work. TODO: add score.
3. “DropBalls” starting at the bottom it looks for the dark gray “MarkEmpty” when it does it stamps it with a “BlackOut” to get rid of the marks. it goes up till it finds a ball, if it does, it sets “DropMoveColor” to 1,2 or 3 depending on the color, then it goes back down to where the first “MarkEmpty” was and draws the ball there. (This part can be a bit more efficient too.)
3 TODO: “MoveColumns” this will do a sweep horizontally from the far right column moveing them over if there's an empty column,
Column 0 will handle the Row 0, column 1 will handle row 1 etc...
if row one is empty, every sprite will copy the previous column to the current one and continue till the far left.
Also I created the column sprites so that each column sprite has the same code except the column number at the top, so I can work on one column- then when I'm done, copy it for the rest of the columns-. then I only have to change the number at the top.
The cursor works like this:
It is constrained to move in increments specified by “Board-SizeOfCells” so the cursor moves always to the middle of the cell the mouse is in.
The cursor is also a sensor- if it is over a ball it 'shows', if not it 'hides'.
when clicked, it switches to a sensor that touches the neighboring cells, if one of them touches the same color as the current cell, it switches to the “MarkEmpty” Sprite and stamps. -which is a black ball with a very dark gray center.
The cursor also sends commands to the column sprites.
Let me know I need to clarify some of this.
-fix/optimize neighboring color elimination.
-make columns move over empty columns.
-add pseudorandom level generation so people can master a level and compare scores.
-animate balls moving.