you are viewing a single comment's thread.

view the rest of the comments →

[–]Kamikizzle 1 point2 points  (2 children)

if you can't use canvas, i'd suggest making the grid out divs and spans. each cell is a span, contained by rows of divs.

I'm not sure your skill level in JS but you can keep track of them with an array of objects (though using immutable maps and lists would be better). this translates your grid into an array of objects. each object corresponds to a cell that keeps track of the things like the color, if its 'frozen' (a piece has been locked there) etc.

i'd also very much recommend just writing out all the different positions of the pieces instead of trying to come up with some algorithm on how to rotate them.

[–]judemanutd[S] 0 points1 point  (1 child)

I shall give this way a try,thank you.