# 1010! Clone Template (W.I.P)

**597**

Hello,

I had a spare few hours and decide to see if it was possible to create one of my favourite games to play on commute.

Quite happy with the results so far. I am sure others have created something similar already but thought I would share my progress thus far.

I managed to fix any layering issues, as shown, so each piece can be moved over any other piece.

I initially just had one piece appear at the bottom to avoid finding a solution... until it got a little too boring to test.

So I then added in an extra piece to spawn. I think two is ideal as it gives time to play around with more 'odd' shapes, rather then 3 different ones in the released game.

At the moment I only have 12 different shapes. It takes about 30 seconds to add in a new design shape using tables which was nice.

The design is very basic at the moment. Hopefully will be able to work on something more appealing.

Sound will be nice too.

The next big tasks include finishing the GameOver logic to determine if any possible moves left with the remaining pieces. And to add in bonuses for multiple rows/cols of blocks removed at once.

You can check out the demo video below.

Best,

Two.E

## Comments

9,258That's very neat! Interested in keeping up with your progress!

My GameSalad Academy Courses!◦Check out my quality templates!◦ Add me on Skype: braydon_sfx597Update:The biggest challenge was determining when a game has ended because no valid moves left.

But - I had to also take into consideration that there are two pieces , so one might not fit, but if the second one is placed, and then removes some blocks, the first piece might be able to place.

This was pretty easy fix. Essentially I am checking if a shape can fit every time the touch count = 0.

If both pieces can not fit at the same time - then there is no possible moves.

If one piece remains and can not fit - then no possible moves left.

Otherwise - let the game continue until player figures it out.

Next: How the heck am I checking if a shape can fit? Through loops.Basically I assigned a Col number to each piece. Which you can see at the top of the screenshots. With the first number representing the shape on the left. The second for the shape on the right.

In image 1, you can see that for the first shape, the game knows there is spot in the first column I can place it. For the second shape, the game knows the current possible position is in column 6. Of course it hasn't checked any columns after 6 because it doesn't need to since it already found a match.

What that is telling me is what is the lowest column number that shape can be placed in.

If this number is equal to 11, then no possible moves.

In the loop, I check several things for each row in column 1.

For each shape, I assign a starting block. Then for each other block I reference what its position from the starting block. This is done for each shape and stored in a table.

For each block, I check to see what its Row and Col number will be depending if the starting Block is placed in a particular row in col 1.

If any of the above conditions occur, I simply restart the loop but with row +1. (check the next row down).

If all the conditions do not occur, I then check if all spaces are empty. This is simply echoing if a table has a value of 0 based on the row/col values.

If all blocks are empty stop all loops since there is no need to check any more since I know the shape can be placed.

Otherwise, I change to row + 1 and check again.

Finally, if my row count is equal to 11, it means my shape could not fit in any rows in this column. So I change my Column count to +1, set my row value back to 1, and then loop again.

That means, that if my column number is equal to 11, it has gone through the 10x10 grid and found no possible spaces where my shape could fit. Thus meaning no possible moves.

I made the colours on the grid have a darker bottom side if there is no other square below them, this gives it a bit more in-depth fill and will be part of the design I am going for.

Not sure if any of that made sense, but thought I would share. I am currently looking at how to add bonuses for multiple row/col clearing of blocks. And maybe a simpler way to detect shape moves.

Thanks for reading,

Two.E

GSLearn.com| Templates | Free Demos | Udemy Course597GSLearn.com| Templates | Free Demos | Udemy Course453Thanks for sharing, I would like do one game like this some day :P

597Thanks @Braydon_SFX (i.e My biggest supporter 3 years in the running).

@CasualEvolution I will look forward to it!!

UPDATE:Added in an extra 40 playable pieces for total of 50. There is still many more to add, especially with bigger ones that fit in a 4x4 gird. You can see the ones I have added below. (The ones that are black are like this because I am lazy and haven't assigned a unique colour to all new ones).

Brief Summary:While this took just under 2 hours to add in and test, I came across a situation I didn't think of prior.

Not every piece should have the same probability to be called on. Since same are way to big to be played all the time.

Since all pieces have an ID, between 1 and 50, to spawn a pieces I had just been calling a random number between 1-50.

What had to change, was add in a new table called RANDOM. Each row contained a value equal to the piece I want to spawn.

The idea is that I create a table with more than 5o rows, and fill any extra rows with duplicate values of pieces I wanted to have a greater chance to be spawned.

That simply means entering, for example piece #3, the value 3 into 10 different rows. Now it has 9 times more likely to be called.

I then went through and ranked each different shape with a difficulty between 1 and 3, with 1 being the easiest.

For each piece that was ranked 1 - would be entered into the table 10 times.

For each piece ranked 2 - would be entered into table 5 times

For each piece ranked 3 - would be entered into table 3 times.

(I am leaving room for more difficult pieces I have not yet added to game).

Then, I just random pick a row from the Table and spawn the Piece equal to that value.

Very simple solution and gives access to quick and easy customisation on difficulty of game.

Plus, something to be explored later on is that you can gave certain modes that only use particular shapes, to make it more difficult or easier etc.

Whats Next?I think I have about 20-30 new shapes to add. I would like to do that next to get it over the way. I prob make a quick video on how easy it is to add in any shape.

I found a bug where the Snap to Grid is out by a 1-3 pixels, and on very rare situations manipulates the shape when placed on the board. It just means I haven't gotten my maths rounding exactly right.

Adding colours for each piece. I have no idea how I am going to approach this yet. Will wait for all shapes to be added.

Thanks for Following!

Best,

Two.E

GSLearn.com| Templates | Free Demos | Udemy Course9,258Well shucks!

Seriously tho - you always come out with great mechanics and you have a knack for design as well. It really shows what GameSalad can do. I know a lot of people are “scared” of tables because they can seem daunting to learn and tackle, but all of your mechanics show the opportunities that become possible when you utilize tables in a smart way. I’m really looking forward to your next update!

My GameSalad Academy Courses!◦Check out my quality templates!◦ Add me on Skype: braydon_sfx597Just a quick update for those interested.

get closer...weBest,

Two.E

GSLearn.com| Templates | Free Demos | Udemy Course453ok...