Hi guys,
Ran into another problem. I've been following an online tutorial on how to make a match 3 game. I typed over te code, but it's not working for me. The guy who made this tutorial is not responding to my questions so I thought I would ask it here. What I'm trying to do is make the game start without any matches already on the board (see my code below). But no matter what I try I can't get it working. Could you please help me? Thnx!
//initialize the game
width = 6;
height = 10;
offset = 32;
xstart = 88;
ystart = 216;
dot = noone;
maxLoops = 0;
for (i=0; i < width; i++){
for (j=0; j <height; j++){
instance_create(offset * i + xstart, offset * j + ystart,obj_background_tile)
var dot = instance_create(offset * i + xstart, offset * j + ystart,obj_dots)
if(i>1 && j>1)
{
//check both left and up
while((instance_position(dot.x - offset,dot.y,obj_dots).image_index == dot.image_index
&& instance_position(dot.x - 2*offset,dot.y,obj_dots).image_index == dot.image_index)
|| (instance_position(dot.x,dot.y-offset,obj_dots).image_index == dot.image_index
&& instance_position(dot.x,dot.y-2*offset,obj_dots).image_index == dot.image_index))
//&& maxLoops < 100)
{
//change the dot's image and increase the maxLoops
dot.image_index = irandom(8);
//maxLoops ++;
}
}
else if (i > 1){
//check left
while((instance_position(dot.x - offset,dot.y,obj_dots).image_index == dot.image_index
&& instance_position(dot.x - 2*offset,dot.y,obj_dots).image_index == dot.image_index))
//&& maxLoops < 100)
{
//change the dot's image and increase the maxLoops
dot.image_index = irandom(8);
//maxLoops ++;
}
}
else if (j > 1){
//check up
while((instance_position(dot.x,dot.y-offset,obj_dots).image_index == dot.image_index
&& instance_position(dot.x,dot.y-2*offset,obj_dots).image_index == dot.image_index))
//&& maxLoops < 100)
{
//change the dot's image and increase the maxLoops
dot.image_index = irandom(8);
//maxLoops ++;
}
}
}}
alarm[0]=20;
state = "Fill";
Ran into another problem. I've been following an online tutorial on how to make a match 3 game. I typed over te code, but it's not working for me. The guy who made this tutorial is not responding to my questions so I thought I would ask it here. What I'm trying to do is make the game start without any matches already on the board (see my code below). But no matter what I try I can't get it working. Could you please help me? Thnx!
//initialize the game
width = 6;
height = 10;
offset = 32;
xstart = 88;
ystart = 216;
dot = noone;
maxLoops = 0;
for (i=0; i < width; i++){
for (j=0; j <height; j++){
instance_create(offset * i + xstart, offset * j + ystart,obj_background_tile)
var dot = instance_create(offset * i + xstart, offset * j + ystart,obj_dots)
if(i>1 && j>1)
{
//check both left and up
while((instance_position(dot.x - offset,dot.y,obj_dots).image_index == dot.image_index
&& instance_position(dot.x - 2*offset,dot.y,obj_dots).image_index == dot.image_index)
|| (instance_position(dot.x,dot.y-offset,obj_dots).image_index == dot.image_index
&& instance_position(dot.x,dot.y-2*offset,obj_dots).image_index == dot.image_index))
//&& maxLoops < 100)
{
//change the dot's image and increase the maxLoops
dot.image_index = irandom(8);
//maxLoops ++;
}
}
else if (i > 1){
//check left
while((instance_position(dot.x - offset,dot.y,obj_dots).image_index == dot.image_index
&& instance_position(dot.x - 2*offset,dot.y,obj_dots).image_index == dot.image_index))
//&& maxLoops < 100)
{
//change the dot's image and increase the maxLoops
dot.image_index = irandom(8);
//maxLoops ++;
}
}
else if (j > 1){
//check up
while((instance_position(dot.x,dot.y-offset,obj_dots).image_index == dot.image_index
&& instance_position(dot.x,dot.y-2*offset,obj_dots).image_index == dot.image_index))
//&& maxLoops < 100)
{
//change the dot's image and increase the maxLoops
dot.image_index = irandom(8);
//maxLoops ++;
}
}
}}
alarm[0]=20;
state = "Fill";