# Permanent Adjacency Problem [Gamemaker Studio]

Situation: I started work on a pet project recently. It's a bit like Puzzlecraft, or Bejewled, but slightly different. You click one gem, as we'll call it, and if it's the first in the link, then it's added to the link.

That works well enough. However, the problem comes in that after that, in order to link, it must be adjacent to the last link... and somehow, something goes wonky. The first time you click something not adjacent, it doesn't get put on the link...or it at least doesn't highlight. It also doesn't run across any of my show_message popups - aside from "second else".

Yet, somehow, it seems to act as though that one you clicked on was the Last_Link, after that point...permanently...which shouldn't even be possible...

So, if you click adjacent to the one that got to "second else", it will still consider that "adjacent", even if it's across the entire board from the last one that actually highlighted.

And this permanent allocation of Last_Link can happen for every gem on the board. At the same time. (Note: It does deallocate once you restart the program.)

This DOESN'T make sense!

I have no step events (yet). This is also the only left click event in the game at the moment. Every other event is a create or game start event, mostly for initialization purposes. So I have no idea what is doing this. Can someone tell me?

Left Click Event for the Gems


if (obj_Handle_Links.Match_Length = 0) //if this would be the first in the link
{
obj_Handle_Links.Match_Length +=1; //because we're increasing the length
image_index = 1; //this should highlight
show_message( Matrix_Location_y );
}
else
{
// show_message("first else");
//check if the target is the same type as the last Link's type
//includes diagonals
{

show_message( Matrix_Location_y );
//show_message("third if");
obj_Handle_Links.Match_Length +=1; //because we're increasing the length
image_index = 1; //this should highlight
}
else{

show_message("second else");

• right. I forgot to indent the show_message stuff because I intentionally put them out of indent for ease of finding them in the code later. Thanks. I have indented them for the question. – SangoProductions Jun 15 '16 at 2:27