GML Using While Loop To Make Tetris Quick Drop

T

Taylor Romey

Guest
Hey everyone. I am trying to make a quick drop function in my Tetris game that makes the block instantly fall to the bottom when the player presses a certain button.

Currently the blocks fall at a fixed rate of 16 pixels every second. So when the player presses the space key, I have a while loop that checks if the area 16 pixels below the block is free, and if so keep dropping by 16 pixels until the area is not free, but it does not seem to be working.

Code below:

Code:
    if(keyboard_check_pressed(vk_space))
        {
        while(place_free(x,y+16))
            {y += 16;}
        instance_create_depth(room_width/2,-32,0,obj_block_t); block_on = 0;
        }
Is there something off with the logic of it or is the while loop perhaps not be the best way to be going about this?

Taylor



EDIT: I have fixed it. There were a few brackets misplaced T_T
 
Last edited by a moderator:
Top