Recent

Author Topic: Started on one of those block games  (Read 571 times)

TBMan

  • Sr. Member
  • ****
  • Posts: 277
Started on one of those block games
« on: June 30, 2025, 05:09:06 am »
** edited **

I got one of these for my phone recently. I have had other versions too. The game has different block shapes and you have to place them on a grid to complete a vertical or horizontal row to get points. If you can't fit one of the 3 shapes provided (that changes every round), you lose. 

Initially, I felt that using overloaded procedures is the best way to do this so I don't go nuts trying to remember the names of each procedure. I have different sized arrays for the various shapes (not completed). This might change to just one or two arrays ([0..2,0..2] and [0..3]) with some info to tell which squares are part of the shape and also x1,y1,x2,y2 info for each piece of the block (calculated constantly) to see if it fits on the board and where.

**edit**

Now that I have had a day to kick it around in my head I think I am going to use one 4x4 array type and then designate whether a block is used and have each individual block have its on Trect (x1,y1,x2,y2) to test if the block pieces are within the main game rectangle for legal placement.

I actually found that I could create a "boundary" around the shape which I use to determine if the shape is on the grid and it helps to see if the placement is valid within the game board.


So here's my crude start. I'm not afraid to scrap this and start over (I'm trying another version as I edit this). I think the data planning is interesting and deeper than first glance. I haven't ruled out using OOP if I do it over, but once a block shape is put on the board, it can be just reused in another round without recreating it. I have all the shapes I am going to use sketched out on graph paper, which really helps.

I used ptcgraph and ptcmouse with page flipping.

https://www.youtube.com/watch?v=CQZinUum6X0
« Last Edit: July 01, 2025, 06:00:39 am by TBMan »
I love programming.

Some things I've done using PTCgraph:

NFL Retro Football (almost finished):
https://www.youtube.com/watch?v=78mTtsd7ppk


Solitaire games:
https://www.youtube.com/watch?v=zmtxI7FdWuQ&list=PLa4BPpFl34iVhFwX1JZwVm3vE5ay_i3R2

 

TinyPortal © 2005-2018