Master Cabalist
Member
Hi
I am making a. little app but I am having trouble with MoveTo The character is th
e GobbleWizard. You supposed to click on a spot
on the background and the GobblerWizard moves to that point and it sits now. What is happening is it moves to the target l location but then
keep movement in that direction. I even do the function to check distances and it seems it is not effective. Code below:
Step Event:
I am making a. little app but I am having trouble with MoveTo The character is th
GML:
/// @description Insert description here
// You can write your code in this editor
//if mouse check is triggered then check against the
//Glob Wizard and run delete routine
if (mouse_check_button_released(mb_left))
{
pos_x = mouse_x;
pos_y = mouse_y;
//if (position_meeting(x, y, ScatterIcons))
//{
//}
//if (position_meeting(x, y, ScatterIcons))
//{
///if flight == true
//{
if point_distance(x, y, pos_x, pos_y) > 5 //flight is equal to true
{
move_towards_point(pos_x, pos_y,5);
// flight = false;
}
else
{
speed = 0;
//at location
if x <= 0
{
x = 0;
}
if (y <= 0)
{
y = 0;
}
if (x > 1600)
{
x = 1600;
}
if (y > 1600)
{
y = 1600;
}
}
//}
//
//}
if (x < 0 || y < 0 || x > 1000 || y > 1000)
{
show_debug_message("ScatterIcons.x");
pos_x = mouse_x
pos_y = mouse_y
flight = true
if point_distance(x, y, pos_x, pos_y) > 5 //flight is equal to true
{
move_towards_point(pos_x, pos_y, 5)
flight = false;
}
else
{
//speed = 0;
//flight = true
}
}
}
on the background and the GobblerWizard moves to that point and it sits now. What is happening is it moves to the target l location but then
keep movement in that direction. I even do the function to check distances and it seems it is not effective. Code below:
Step Event: