• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

I need help with a building blocks thing

L

LegionZ_Gaming

Guest
so im testing a building method and im checking for the snap to grid, free space, and if connected to a block on all sides so u cant create one in thin air i have the free space and the snap to grid but i cant figure out the last one and suggetions?
here is my code i will underline what i need to fix

x = mouse_x
y = mouse_y
move_snap(32,32)
if place_empty(x,y) && place_snapped(OBJ_Building_Block_Temp +- 32, OBJ_Building_Block_Temp +- 32) && mouse_check_button_released(mb_left)
{
instance_create_layer(x,y,"Instances",OBJ_Building_Block_Temp)
}

i will also need it to follow the object while it moves in the game
 

Tony Brice

Member
x = mouse_x;
y = mouse_y;
move_snap(32,32);
if (place_empty(x,y)
{
if (place_snapped(OBJ_Building_Block_Temp +-32, OBJ_Building_Block_Temp +32)
{
if (mouse_check_button_released(mb_left)
{
instance_create_layer(x,y,"Instances",OBJ_Building_Block_Temp);
}
}
}

I rewrote the code to break it into manageable chunks as it's easier to read through and trace your problem then.

It may not look like I actually changed anything but if you notice the line where you use place_snapped then you'll see the check does a +-32 and the second part check +32. If I understand your problem correctly then it looks like you were looking at the tile to the left in both conditions originally whereas +32 means look to the right.
 
L

LegionZ_Gaming

Guest
Now i need help with making my 1 key a toggle ON/OFF like a switch to hide something when i dont need it and i deleted all my code i tried toggling true and false stuff but i think i did it wrong
 
Top