Jump to content


Photo

instance either jumps or stops moving


  • Please log in to reply
No replies to this topic

#1 vandordeak

vandordeak

    GMC Member

  • New Member
  • 10 posts
  • Version:GM:Studio

Posted 29 March 2016 - 08:28 AM

Hi all,

 

I want to move an object to a certain point and if I do the following it will jump to the correct position

 

in step event: 

if point_distance (x, y, move_target.x + GRID_WIDTH/2, move_target.y  + 87 ) >  2
            {   
                x = move_target.x + GRID_WIDTH/2;
                y = move_target.y +87 ; 
            }

However the following code will make the instance move to the right direction but it will not stop there

            if point_distance (x, y, move_target.x + GRID_WIDTH/2, move_target.y  + 87 ) > 2
            {  
                move_towards_point(move_target.x + GRID_WIDTH/2, move_target.y + 87 , 10 );
            }
            
            if point_distance (x, y, move_target.x + GRID_WIDTH/2, move_target.y  + 87 ) <=  2
            {   
                speed = 0;
                x = move_target.x + GRID_WIDTH/2;
                y = move_target.y +87 ; 
            }

I have been trying to figure it out in the last three hours but I cannot get it work. Please, help!


  • 0