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
And the code inside the scr_collideandmove script that deals with movement and collisions is:
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
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();
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
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