FigureOfLife
Member
So, I have a 64x64 object (matching sprite) which shakes at certain diagonals, but not all. I have tried many methods and watched many tutorials. I am pretty sure it is the object, not the camera, because it does this even when the camera is not moving. The ratio is constant, there is no zoom, and the object step looks like the code below right now. I originally used speed rather than the x/y format at the end. I've used floor and I've used round. They all produce the same problem.
//Set speed:
if(mouse_check_button_pressed(mb_left) && Lock=0)
{
move_speed_this_frame=move_speed;
//The place which is clicked:
click_x = round(mouse_x);
click_y = round(mouse_y);
//The direction from the player to the point clicked:
direction=point_direction(round(x),round(y),click_x, click_y);
hspd=lengthdir_x(move_speed,direction);
vspd=lengthdir_y(move_speed,direction);
//speed=move_speed_this_frame;
}
if(distance_to_point(click_x, click_y)<=1 && Lock=0)
{
click_x=-1;
click_y=-1;
hspd=0;
vspd=0;
speed=0;
}
if(speed>0){
if(tile_meeting(x,y,tilemap))
{direction=point_direction(floor(x),floor(y),mapCenterX,mapCenterY);
speed=move_speed_this_frame;
Lock=1;
alarm[0]=room_speed*1;
}
}
x=round(x)+hspd;
y=round(y)+vspd;
//Set speed:
if(mouse_check_button_pressed(mb_left) && Lock=0)
{
move_speed_this_frame=move_speed;
//The place which is clicked:
click_x = round(mouse_x);
click_y = round(mouse_y);
//The direction from the player to the point clicked:
direction=point_direction(round(x),round(y),click_x, click_y);
hspd=lengthdir_x(move_speed,direction);
vspd=lengthdir_y(move_speed,direction);
//speed=move_speed_this_frame;
}
if(distance_to_point(click_x, click_y)<=1 && Lock=0)
{
click_x=-1;
click_y=-1;
hspd=0;
vspd=0;
speed=0;
}
if(speed>0){
if(tile_meeting(x,y,tilemap))
{direction=point_direction(floor(x),floor(y),mapCenterX,mapCenterY);
speed=move_speed_this_frame;
Lock=1;
alarm[0]=room_speed*1;
}
}
x=round(x)+hspd;
y=round(y)+vspd;