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

Discussion Collision differences in runtime 2.1.3.189 vs recent runtime updates

tibbycat

Member
I saw that some people were having collision problems also with the latest runtime updates. Was that just with objects that use physics? My game doesn't and my collisions are broken too.

This is my player character jumping and colliding with the invisible wall objects in the older Runtime Version No. 2.1.3.189 -



The collision works as it should in the above gif.

Whereas below is my player character jumping and colliding with the invisible wall objects in Runtime Version No. 2.1.4.202 (and it performs the same in 2.1.4.200). Note how the player character is less graceful in falling upon hitting the ceiling. It's very sudden. Also at the end of the gif I break through the invisible wall collision object. I couldn't replicate that in the previous Runtime.



This is how this location looks in the room editor:



The transparent squares are the wall objects.

Regular movement and collisions come from two scripts. The first one, for regular movement is called scr_player_normal

Code:
scr_getinputs();

//Normal Movement
if (!global.player_stationary)
{
    hsp = 2 * (key_right - key_left);
}
else
    hsp = 0;

//when on quicksand
if (!global.player_stationary) && (place_meeting(x,y,obj_quicksand_regular))
{
    hsp = 1 * (key_right - key_left);
    vsp += 0.075;
if vsp > 1
    {
        vsp = 1;
    }
}

//gravity
if (!global.player_stationary) && (!place_meeting(x,y,obj_quicksand_regular))
{
    vsp += 0.2;
}

//can the player jump?
if (place_meeting(x,y+1,obj_solid) || (place_meeting(x,y+1,obj_climb)) || (place_meeting(x,y,obj_quicksand_regular)))
{
    if (key_jump) && (!global.player_stationary) && (!place_meeting(x,y,obj_quicksand_regular))
    {
        vsp = -4;
        audio_play_sound(snd_jump, 7, false)
    }
    else //when jumping on quicksand
    if (key_jump) && (!global.player_stationary) && (place_meeting(x,y,obj_quicksand_regular))
    {
        vsp = -2;
        audio_play_sound(snd_jump, 7, false)
    }
}

//if you get stuck in the ground - push the player up one pixel
//this is not a very elegant solution though - really need to prevent the player getting stuck in the first place
if(place_meeting(x,y,obj_solid))
{
    y -= 1;   
}

//animation stuff
if ((place_meeting (x, y+1, obj_solid)))
{
    if (hsp==0)
    {
        sprite_index = spr_player_idle;
    }
    else
    {
        if (sprite_index!=spr_player_walk)
        image_index = 0;
        sprite_index=spr_player_walk
        if ((place_meeting(x+1,y,obj_solid) || (place_meeting(x-1,y,obj_solid))))
        {
            image_speed = 0;
        }
        else
        {
            image_speed = .6;
        }
    }
}
else
{
    if (vsp<0)
    {
        sprite_index=spr_player_jump;
    }
    else
    {
        sprite_index=spr_player_fall;
    }
}

if (hsp != 0) image_xscale = sign(hsp); //sign returns 1 if it's positive, -1 if it's negative


if (vsp < 0) && (!key_jump_held)
{
    vsp = vsp/2;
}

//climbing state change
if instance_exists(obj_climb)
{
//snap to climbing when touching it
    if ((place_meeting(x,y,obj_climb)) && (!place_meeting(x,y+1,obj_solid)) && (!key_jump_held))
    {
        hsp = 0;
        vsp = 0;
        sprite_index = spr_player_climb;
        image_speed = 0;
        state = states.climb;
    }

//snap to climbing when touching the ground
//if you're on the ground and you're pressing up
    if (place_meeting(x,y,obj_climb) && (place_meeting(x,y+1,obj_solid)) && (key_up))
    {
        hsp = 0;
        vsp = 0;
        sprite_index = spr_player_climb;
        image_speed = 0;
        state = states.climb;
    }
}

scr_collideandmove();
And the code inside the scr_collideandmove script that deals with movement and collisions is:

Code:
//Collide and Move

// Collisions start

if (hsp != 0)
{
    hsp_dir = sign(hsp);
}

// Horizontal collisions with solid
if (place_meeting(round(x+hsp),round(y),obj_solid))
{
    while (!place_meeting(round(x+sign(hsp)),round(y),obj_solid)) x += sign(hsp);
    hsp = 0;
}
// Move horizontally
x += hsp;

// Vertical collisions with solid
if (place_meeting(round(x),round(y+vsp),obj_solid))
{
    while (!place_meeting(round(x),round(y+sign(vsp)),obj_solid)) y += sign(vsp);
    vsp = 0;
}
// Move vertically
y += vsp;

// Collisions end
I've used a lot of collision code for this from I think Benjamin Anderson (Heartbeast) and Shaun Spalding's collision code on their YouTube tutorials which has been working fine until the last two recent runtime updates. My obj_wall and obj_player objects are both 16x16 with a middle centre origin point and a full image collision mask.

Anyone else had any similar problems and know why this is happening in the latest two runtime updates? It works fine if I change the runtime back to 2.1.3.189
 

Lukan

Gay Wizard Freak
I have only seen this reported with object based collisions.
My tile based system wasn't effected.

I don't know if any one has filed any bugs for it yet, but it couldn't hurt to.
 

hogwater

Member
I don't seem to be having collision issues, are you guys using sprite collision masks or bounding box collisions? I'm using masks.

Things seem fine for me, but I suppose I should do a more thorough check.
 
J

JimiThing85

Guest
Tibbycat, I also use Heartbeast based tile collisions and Shaun Spalding based collision code and the new updates have really screwed them up for me as well. And just like you, everything is fine if I revert to 2.1.3.189
 

tibbycat

Member
@hogwater Bounding box I think...? I'm using the default collision masks for the sprite. I changed it from Automatic to Full Image for both the player and wall objects hoping that would help, but I don't see any difference.

@JimiThing85 Ahh, that's good to know I'm not the only one who's encountered this. I'll just keep using 2.1.3.189 for now then where it works as it should. :/
 
Top