• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

GMS 2.3+ Trying a platformer tutorial, game won't run

Status
Not open for further replies.
I started doing this tutorial and managed to do everything up to 26: 36.

When I click play to test it, it won't run. The Output goes up to "Entering Main loop" and then nothing. The laptop gets to where I can hear the fans, which may not be a good sign, and I even took out the "Collide with wall" code and it still ran. Setting it to 30 FPS didn't work. I checked the code and it's right. Turning on Laptop mode didn’t work.
GML:
//Input
key_left = keyboard_check(vk_left);
key_right = keyboard_check(vk_right);
key_jump = keyboard_check_pressed(vk_space);
//Movement
var move = key_right - key_left;

hsp = move * walksp;

x = x + hsp;

//colliding with wall
if !place_meeting(x+hsp,y,OBJ_Wall) {
    while (!place_meeting(x+sign(hsp),y,OBJ_Wall)){
        x = x + sign(hsp);
    }
    hsp = 0;   
}
Is this an issue with my computer, or is it GMS? How do I fix this?
 

Simon Gust

Member
You have a little error in the collision code, the first place_meeting() should not be negated with "!" because you actually want to check for a collision to collide and not the other way around.
 
Holy cow! That somehow managed to fix it. Again, it wasn’t opening the game up at all.

EDIT: Huh. Did a bit of testing and it seems that was exactly what was causing the problem. That was something I almost thought was the computer or the software.
 
Last edited:

TsukaYuriko

🌠
Forum Staff
Moderator
If your game is stuck in an infinite loop, it will not be able to update what's displayed. If it gets stuck in said infinite loop before the window is created... it also won't be able to create the window. So whenever this happens, you can be almost certain that you have an infinite loop somewhere. ;)

There's a little trick to detect infinite loops:
GML:
var _loop_count = 0;
while (...)
{
    ... loop code ...
    
    _loop_count++;
    if (_loop_count > 100000)
    {
        show_debug_message("AAAAAA");
    }
}
Your game will scream at you if you're stuck in an infinite loop. Now include a hint about where it is and you'll find it in no time.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
Please do not post errors or potential bugs on these forums until the 2.3.0 beta is fully public. There is a beta forum on the helpdesk for these things that should be used until everyone has access to the beta.
 
Status
Not open for further replies.
Top