Abox
Member
Heya! I've been working on my project and I've had this problem for a bit.
I've tried everything I could think of but none of them worked. My problem is when the player jumps, the jump looks really Jittery. The parallax background is also Jittery when the player moves, when the player stops in snaps to the player.
If anyone knows the fix to this please let me know!!
Background Parallax
I've tried everything I could think of but none of them worked. My problem is when the player jumps, the jump looks really Jittery. The parallax background is also Jittery when the player moves, when the player stops in snaps to the player.
If anyone knows the fix to this please let me know!!
Code:
///React to inputs
scr_get_input();
move = key_left + key_right;
//Move Right
if (move == 1)
{
hspd += acc;
if (hspd >= maxspeed) hspd = maxspeed;
} else if (hspd > 0)
{
hspd -= acc;
if (hspd <= 0) hspd = 0;
}
//Move Left
if (move == -1)
{
hspd -= acc;
if (hspd <= -maxspeed) hspd = -maxspeed;
} else if (hspd < 0)
{
hspd += acc;
if (hspd >= 0) hspd = 0;
}
//Running
if key_run
{
maxspeed = 3;
} else if !key_run
{
maxspeed -= 0.1;
if maxspeed < 2 maxspeed = 2;
}
//Gravity
if (vspd < 10) vspd += grav;
if (place_meeting(x,y+1,obj_solid))
{
if (key_jump)
{
vspd = -jumpspeed
audio_play_sound(snd_jump,5,false)
}
}
if (vspd < 0) && (!key_jump_held)
{
vspd = max(vspd,-jumpspeed/3)
}
Code:
//Horizontal Parallax
background_x[0] = floor(view_xview/1.2);
background_x[1] = floor(view_xview/1.4);
background_x[2] = floor(view_xview/1.6);
background_x[3] = floor(view_xview/1.8);
//Verticle Parallax
background_y[0] = floor(view_yview/1.2);
background_y[1] = floor(view_yview/1.4);
background_y[2] = floor(view_yview/1.6);
background_y[3] = floor(view_yview/1.8);
Attachments
-
122.6 KB Views: 0