• 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!
  • 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.

Legacy GM Very Strange Freezing Issue (GMS1.4)

I have this issue where if I jump up to a higher platform while my code has the variable for the attack cycle set to true the entire game hard locks as soon as she hits the floor block, but only when landing on a higher platform. No error or crash, just a complete freeze where the game can't even be exited out.

Footage:


Code for movement/controls and gravity. The Alarm[0] just sets the casting back to false when it goes off to create a firing delay, momentarily pausing movement, and allowing for some sprite changing when attacking when reverts afterward

GML:
///Movement and sprites

//Read Keyboard

if casting = false {

    if keyboard_check (vk_right) {
    hspd = 5;
    image_speed = 0.2;
    sprite_index = Sarah_Right_Spr;
    dir = 1;
    }
    
    if keyboard_check (vk_left) {
    hspd = -5;
    image_speed = 0.2;
    sprite_index = Sarah_Left_Spr;
    dir = -1;
    }

    if keyboard_check (vk_nokey) {
    hspd = 0;
    image_speed = 0;
    }

    if keyboard_check_pressed (vk_space) and place_meeting (x, y+1, wall_block_obj)  {

    vspd = -10;
    vdir = -1;
    }

    if vspd > -1 {
    vdir = 1;
    }

}


//cast spell

if keyboard_check_pressed (vk_alt) and casting = false {
    
    if dir = 1{
    sprite_index = Sarah_Casting_Spr
    image_speed = 0
    image_index = 1
    instance_create (x+50, y+30, Player_Bullet);}
    
    if dir = -1{
    sprite_index = Sarah_Casting_Spr
    image_speed = 0;
    image_index = 2 
    instance_create (x+8, y+30, Player_Bullet);}
    
    
    casting = true;
    alarm[0] = room_speed*0.5;
    }

//Gravity and Collisons
if vspd < 5 {
vspd += grav; 
}


//vertical move andstop
if place_meeting (x, y+vspd, wall_block_obj) {

  
    while !place_meeting (x, y+sign(vdir), wall_block_obj) {
    y += sign(vdir)
    }

vspd = 0;
}

y += vspd;


//horizontal move and stop
if place_meeting (x+hspd, y, wall_block_obj) {

    

    while !place_meeting (x+sign(dir), y, wall_block_obj) {
    x += sign(dir)
    }

hspd = 0;
}

x += hspd;
 
No crash, no error message and such, that makes me think you're getting stuck in your while loop somehow.
Since it happens on collision, that's also a giveaway clue.
 
No crash, no error message and such, that makes me think you're getting stuck in your while loop somehow.
Since it happens on collision, that's also a giveaway clue.
But then why does it only happen when casting is set to false? Before I added that code to stop keyboard checks when the attack cycle was going the game worked fine.
 
I don't know, but the fact that you write
GML:
if(this = that) {do stuff}
instead of
GML:
if(this == that) {do stuff}
probably doesn't help.
Wouldn't be surprised if some code you think is running doesn't run at all.
 
I don't know, but the fact that you write
GML:
if(this = that) {do stuff}
instead of
GML:
if(this == that) {do stuff}
probably doesn't help.
Wouldn't be surprised if some code you think is running doesn't run at all.
From all my Googling that actually doesn't matter in GML unless you're writing in shorthand without "if" statements.

It'll read both those as the same thing
 
I think I found it. For some reason having this little bastard that determines if the player is falling dependent on the casting check was making the game lock up. Will likely also move the nokey check outside the block now that I think about it

2021-02-07.png
 
Top