GameMaker: Studio

GameMaker: Studio

View Stats:
neon Nov 1, 2016 @ 2:53pm
complier stops at entering main loop
i have been trying to run my game after i wrote the all the codes i needed. before i wrote ANY code i could easily run and test my game but now the complier just stops at "entering main loop"
and i cannot run the game.
Last edited by neon; Nov 1, 2016 @ 2:54pm
< >
Showing 1-15 of 16 comments
sandboxgod Nov 1, 2016 @ 3:11pm 
If you are using a while loop anywhere it might be causing it. When using a while loop it wont run any other code till the loop is complete. So this code
while (i < 10)
{
i -= 1;
}

would run forever and force the game to hang.

Main way to tell if its something like that is do you have to hit the stop web server button to be able to launch the game again? Its next to the run the game and run the game with debug buttons.
neon Nov 1, 2016 @ 3:15pm 
Originally posted by sandboxgod:
If you are using a while loop anywhere it might be causing it. When using a while loop it wont run any other code till the loop is complete. So this code
while (i < 10)
{
i -= 1;
}

would run forever and force the game to hang.

Main way to tell if its something like that is do you have to hit the stop web server button to be able to launch the game again? Its next to the run the game and run the game with debug buttons.
so umm how do i solve that?
sorry for being stupid but its my first game and i have been working on it for hours
sandboxgod Nov 1, 2016 @ 3:18pm 
Originally posted by Ne(g)ro:
Originally posted by sandboxgod:
If you are using a while loop anywhere it might be causing it. When using a while loop it wont run any other code till the loop is complete. So this code
while (i < 10)
{
i -= 1;
}

would run forever and force the game to hang.

Main way to tell if its something like that is do you have to hit the stop web server button to be able to launch the game again? Its next to the run the game and run the game with debug buttons.
so umm how do i solve that?
sorry for being stupid but its my first game and i have been working on it for hours

Look for any loops and comment them out with /* at the start and using */ after the loop. Keep testing with all loops one at a time till the game starts working. If it works then that loop is some how running forever and you need to fix that. How to fix that is based on the loop that is causing it.
neon Nov 1, 2016 @ 3:19pm 
while(!place_meeting(x+sign(hsp),y,obj_solid))
{
x += sign(hsp);
}
hsp = 0;


while(!place_meeting(x,y+sign(vsp),obj_solid))
{
y += sign(vsp);
}
vsp = 0;
is there anything wrong with em?
sandboxgod Nov 1, 2016 @ 3:21pm 
The loops themself look fine but how are you using them?
neon Nov 1, 2016 @ 3:23pm 
Originally posted by sandboxgod:
The loops themself look fine but how are you using them?
uhhh
idk
Look i honestly just watched a tutorial for codes and used them for a platformer.
everything went fine and I undertsood EVERYTHING but I just cannot run the game
sandboxgod Nov 1, 2016 @ 3:25pm 
Ok. Answer my first question. Once you attempt to run it and exit it do you have to press the stop web server button to try again?
neon Nov 1, 2016 @ 3:26pm 
Originally posted by sandboxgod:
Ok. Answer my first question. Once you attempt to run it and exit it do you have to press the stop web server button to try again?
Yes, sir!
sandboxgod Nov 1, 2016 @ 3:27pm 
Ok. Just comment the whole step event code from your player object.
neon Nov 1, 2016 @ 3:28pm 
Originally posted by sandboxgod:
Ok. Just comment the whole step event code from your player object.

//Get the player's input
key_right = keyboard_check(vk_right);
key_left = -keyboard_check(vk_left);
key_jump = keyboard_check_pressed(vk_space);

//React to inputs
move = key_left + key_right;
hsp = move * movespeed;
if (vsp < 10) vsp += grav;

if (place_meeting(x,y+1,obj_solid))
{
vsp = key_jump * -jumpspeed
}

//Horizontal Collision
if (place_meeting(x+hsp,y,obj_solid))
{
while(!place_meeting(x+sign(hsp),y,obj_solid))
{
x += sign(hsp);
}
hsp = 0;
}
x += hsp;

//Vertical Collision
if (place_meeting(y+vsp,y,obj_solid))
{
while(!place_meeting(x,y+sign(vsp),obj_solid))
{
y += sign(vsp);
}
vsp = 0;
}
y += vsp;
sandboxgod Nov 1, 2016 @ 3:37pm 
Found the error
neon Nov 1, 2016 @ 3:39pm 
Originally posted by sandboxgod:
Found the error
hm?
sandboxgod Nov 1, 2016 @ 3:39pm 
in the vertical collision section youre doing
if (place_meeting("y+vsp",y,obj_solid))
youre checking on the x axis with the y cordinate.
change it to
if (place_meeting(x,y+vsp,obj_solid))
that should work
neon Nov 1, 2016 @ 3:41pm 
Originally posted by sandboxgod:
in the vertical collision section youre doing
if (place_meeting("y+vsp",y,obj_solid))
youre checking on the x axis with the y cordinate.
change it to
if (place_meeting(x,y+vsp,obj_solid))
that should work
omg thank you so much spending your time on my stupid ass
sandboxgod Nov 1, 2016 @ 3:41pm 
youre welcome.
< >
Showing 1-15 of 16 comments
Per page: 1530 50

Date Posted: Nov 1, 2016 @ 2:53pm
Posts: 16