Day 2-4


Day 2 at it and things went pretty well, all things considered. My focus was on two functions: pushing new lines to a board and clearing matches. I was able to accomplish both without many issues. However this did bring to light the fact that my array idea is a bit flawed. The Z axis representing the player is not a great idea as I need to be able to push Y-elements in which affects both layers of the Z axis. So I scrapped that and decided to create a second instance of the game board array with an instance variable for which player it represents. It ended up working out better.

For the money clearing algorithm, I basically have a temp array that I push XY values to as it runs a match checking algorithm to compare adjacent values on the board. If it returns enough elements to clear the cluster (i.e. five  or more 1's), then it passes this array onto the "cluster clear" algorithm which cleans up the board and exchanges up the value of one of the money balls (if it's not 500).

I ran into some issues with sprites not always accurately representing the game board array. My array manipulation events have been working perfectly, but I noticed sometimes the screen was not accurately representing this (mismatched values and money clearing or not clearing when it should). After a few hours or debugging I decided to change how I was calling some of the functions. Turns out functions  in Construct 2 have trouble interacting with objects that were created in the same function call (at least that's what seemed to be happening in my case). I basically set it so the objects are created before running the functions on them and that fixed my problems.

After getting this working, I made some tweaks to the events to allow for a second player. This worked out perfectly as all I had to do was create a second instance of the Game Board object and the rest of the objects are created at the start of layout and the events are all setup to pass the game board instance variable of 'player'. 

I uploaded what I have done so far. Please check it out and let me know what you think! ^_^

Files

MMM.zip Play in browser
Oct 07, 2019

Leave a comment

Log in with itch.io to leave a comment.