Initial Creation of the Block Game


Heyo, 

This month I'm doing a block stacking game where you clear rows by filling a row.  I've been slow on the coding this month, but I'm happy to have gotten the base game down. Eventually, I'm going to add some kind of feature that aligns the game with the day/night theme of OGAM24. I may add some kind of day-night visual cycle or some kind of mechanic that interacts with a day-night cycle.  It'll be gimmicky.

I'll talk about how I tackled the block stacking game here. 

I did a simple 10x22 grid that is represented through a nested list containing ints going x, y, and block color. I had individual grids for placed, or locked blocks, and active blocks being moved. The game works by updating the grid every few seconds (or less, depends) and most functions depend on that. I tried to distance some code from that, but most essential functions are located within the spaced-out updates. Every update the active block is moved down, and queued actions are carried out. Most actions requiring player input are constantly checked for and when the condition to carry out an action is fulfilled it will queue that action for when the next board update occurs. Actions like rotating, moving horizontally, snap placing, and fast falling are done this way. I haven't had any problem with it so far. 

 On to how I managed row clears (this area isn't fully done, but here's what I did). Firstly, I made a list of booleans 22 items long that represent each y row and if they are marked to be cleared or not. Whenever a block is placed, a function is called checking every row in a for loop marking the list accordingly when it detects a full row.  After all the rows are checked, the function runs through all the marked rows' tiles and sets them to zero (the tiles are assigned a number,  0 is empty). 

So this is where it gets spotty. To move the blocks down after a number of clears, I take the number of rows cleared (stored in an int) and simply subtract every non-cleared row's elevation by that. This doesn't work due to mishandling a lot of edge-case scenarios. So it's priority to fix it. I stuck it together in the last moments before uploading to just get it over with hahaha. It probably won't be too difficult if I tackle it with a fresh mind.

Some notes on what I plan to add on top of what I listed before:

  • I want to add a ghost thingy to project where the player's blocks will fall 
  • Block-based wall kicks. It works for the outer walls, but not placed blocks.
  • Actual loss state and a way to restart
  • Menus

If you got any thoughts leave them below,

Thanks for reading and/or playing!

Files

0.0.1.zip Play in browser
Jun 22, 2023

Leave a comment

Log in with itch.io to leave a comment.