D
Darth Raven
Guest
Hello! Two problems are presented on this post.
#1
I'm having a issue with a drag and drop movement, which is the object is not returning to the place it should be. I'm using "distance to point" which is maybe the problem. It never returns to the exact point I want, it goes near the point.
In resume, I want to achieve a better Drag and Drop movement.
Let's assume the first object called " ThisO " .
I've this:
Create event:
Step:
//Image Alpha
image_alpha = alpha;
alpha +=0.01;
if alpha >= 1
{alpha = 1
}
//Button
if alpha=1 and mouse_check_button_pressed(mb_left)
{drag = true;}
if alpha= 1 and mouse_check_button_released(mb_left)
{drag = false;}
//Drag movement
if drag = true and alpha = 1
{
x = mouse_x;
y = mouse_y;
}
if distance_to_point(160,160)>0 and drag = false
{move_towards_point(160,160,5)
}
else
speed =0
//Code that solved
if speed =0 and drag = false
{x=160
y=160}
[/CODE]
#2
A bit out of the context of the tittle... I'm using a object with the text " This " . I know how to create a "draw text", however I'm not able to work with the draw as a object ( to drag and drop ). Or is it possible to do it?
Thanks and good night!
ED1: I've edited the code. I still dont know how to drag it to the original place.
ED2: I've solved the problem of Drag and Drop. However question number 2 has not bee answered yet.
#1
I'm having a issue with a drag and drop movement, which is the object is not returning to the place it should be. I'm using "distance to point" which is maybe the problem. It never returns to the exact point I want, it goes near the point.
In resume, I want to achieve a better Drag and Drop movement.
Let's assume the first object called " ThisO " .
I've this:
Create event:
Code:
x=160
y=160
alpha =0;
drag = false;
Step:
//Image Alpha
image_alpha = alpha;
alpha +=0.01;
if alpha >= 1
{alpha = 1
}
//Button
if alpha=1 and mouse_check_button_pressed(mb_left)
{drag = true;}
if alpha= 1 and mouse_check_button_released(mb_left)
{drag = false;}
//Drag movement
if drag = true and alpha = 1
{
x = mouse_x;
y = mouse_y;
}
if distance_to_point(160,160)>0 and drag = false
{move_towards_point(160,160,5)
}
else
speed =0
//Code that solved
if speed =0 and drag = false
{x=160
y=160}
[/CODE]
#2
A bit out of the context of the tittle... I'm using a object with the text " This " . I know how to create a "draw text", however I'm not able to work with the draw as a object ( to drag and drop ). Or is it possible to do it?
Thanks and good night!
ED1: I've edited the code. I still dont know how to drag it to the original place.
ED2: I've solved the problem of Drag and Drop. However question number 2 has not bee answered yet.
Last edited by a moderator: