Ur code structure is wrong. make use of functions to properly structure your code. Do something like this...
Code:
//define variables
...
//1 function or many functions
function gameplay()
{
...
}
function main()
{
//set video_modes
...
//load level
level_load(my_level.wmb);
wait(2);
//call game functions
gameplay();
//if u want to load another level
if (exit)
{
level_load(credits.wmb);
}
}