R
RoyTheDragon
Guest
Good timezone to y'all, new to the forum but not new to Game Maker: Studio 1.4.9999 (the version I'm using at the moment) please forgive me if the formatting and tag of this is incorrect in any way possible.
I've had some time to try and develop my own game but want to be able to develop match 3 style games,
I seem to have an issue where the results of the loop will not give me any sign that it's running and just to show you what I've got for the loop, this is more to make the pieces clear from the board, before I was actually making it so that the game would automatically detect if there's 2 of the same colour on each side but that deemed a little problematic from the fact that it only cleared 3 instead of the entire cluster.
I'm going to show 3 blocks of relevant code in this post to possibly open up some possibilities as to what might not be running properly. One for the destroy loop, one for clearing the pieces that are affected and also the one before which checks if there's a specific amount of pieces.
Here's a few things to note before anything else
all the variables here are defined in a creator instance where they're only touched once when the game is run.
so things like spacer, spacermin, curx, cury, etc. are all defined in such a manner that if i were to change something, it would work regardless of what kind of change I did.
and after further testing and attempt of fixing and why I still couldn't see any results I put a couple variables in as a global to put into my creator's draw block to see what's going on, they're not really used for much else anyway and it seems to be that the loop is getting stuck somewhere when looping, more specifically at object ID 100165.
I'm aware that things like a loop ending prematurely could cause issues like this, there maybe other factors of which I'm not looking into too much. I've practically nowhere to turn.
I've had some time to try and develop my own game but want to be able to develop match 3 style games,
I seem to have an issue where the results of the loop will not give me any sign that it's running and just to show you what I've got for the loop, this is more to make the pieces clear from the board, before I was actually making it so that the game would automatically detect if there's 2 of the same colour on each side but that deemed a little problematic from the fact that it only cleared 3 instead of the entire cluster.
I'm going to show 3 blocks of relevant code in this post to possibly open up some possibilities as to what might not be running properly. One for the destroy loop, one for clearing the pieces that are affected and also the one before which checks if there's a specific amount of pieces.
Here's a few things to note before anything else
all the variables here are defined in a creator instance where they're only touched once when the game is run.
so things like spacer, spacermin, curx, cury, etc. are all defined in such a manner that if i were to change something, it would work regardless of what kind of change I did.
and after further testing and attempt of fixing and why I still couldn't see any results I put a couple variables in as a global to put into my creator's draw block to see what's going on, they're not really used for much else anyway and it seems to be that the loop is getting stuck somewhere when looping, more specifically at object ID 100165.
I'm aware that things like a loop ending prematurely could cause issues like this, there maybe other factors of which I'm not looking into too much. I've practically nowhere to turn.
GML:
for (i = 0; i < 10; i++) // the script I'm using for the matching function. (named destroyer)
{
for (v = 0; v<10; v++)
{
curx = sx + (i * spacer) ;
cury = sy + (v * spacer) ;
curxm = msx + (i * spacermin) ;
curym = msy + (v * spacermin) ;
curpiece = instance_position(curxm , curym , obj_mini) ; // current minimap piece
curbpiece = instance_position( curx ,cury , obj_pieces) ; // current main board piece
if instance_exists(curbpiece)
{
if (instance_exists(instance_position(x + 32 , y , curbpiece)) and instance_exists(instance_position(x - 32 , y , curbpiece))) and (instance_position(x + 32 , y , curbpiece).image_index == curbpiece.image_index and instance_position(x - 32 , y , curbpiece).image_index == curbpiece.image_index) // horizontal
{
curbpiece.infected = true ; // this causes other pieces that are the same colour to be infected horizontally
}
if (instance_exists(instance_position(x , y + 32 , curbpiece)) and instance_exists(instance_position(x , y - 32 , curbpiece))) and (instance_position(x , y + 32 , curbpiece).image_index == curbpiece.image_index and instance_position(x , y - 32 , curbpiece).image_index == curbpiece.image_index) // vertical
{
curbpiece.infected= true ; // this causes other pieces that are the same colour to be infected vertically
}
}
}
}
if not moving //this checks if there's nothing moving on the board before executing
{
clear();
}
GML:
with(obj_pieces) //the code I'm using for when the loop above is done. (named clear)
{
if infected
{
instance_destroy(); // should clear those that are in the cluster (infected=true)
}
}
cycling=false;
GML:
//part of step block in an object named Cycler.
if instance_number(obj_pieces) <81 // checks if the board has exactly 81 pieces
{
moving = true;
}
else
{
moving = false;
}
if not cycling
{
cycle();
}