Hello,
I`ve got a small problem with dragging an object, hopefully someone can help tell me why that this is happening.
The problem is that I have an object on the screen and I want to be able to move it by firstly clicking on it
and while the mouse button is still pressed down I want it to follow the mouse and be release in it`s new
location when I release the mouse button. Sounds simple enough.
I have hidden the pointer and loaded an image to replace it so that I can detect a collision between it and
the object.
Here`s the code and the problem.
;-------------------------------
if imagesoverlap(pointer,mousex(),mousey(),object,xpos,ypos) and mousedown(1)
xpos=mousex()
ypos=mousey()
endif
drawimage object,xpos,ypos
drawimage pointer,mousex(),mousey()
;-------------------------------
This works to some extent but the problem is that when I move the mouse to fast the object is droppped when
I really want it to stay with the mouse until I let go of the mouse button.
Any ideas on the cause of this and how I could rectify the problem?
Thanks,
Jason.
I`ve got a small problem with dragging an object, hopefully someone can help tell me why that this is happening.
The problem is that I have an object on the screen and I want to be able to move it by firstly clicking on it
and while the mouse button is still pressed down I want it to follow the mouse and be release in it`s new
location when I release the mouse button. Sounds simple enough.
I have hidden the pointer and loaded an image to replace it so that I can detect a collision between it and
the object.
Here`s the code and the problem.
;-------------------------------
if imagesoverlap(pointer,mousex(),mousey(),object,xpos,ypos) and mousedown(1)
xpos=mousex()
ypos=mousey()
endif
drawimage object,xpos,ypos
drawimage pointer,mousex(),mousey()
;-------------------------------
This works to some extent but the problem is that when I move the mouse to fast the object is droppped when
I really want it to stay with the mouse until I let go of the mouse button.
Any ideas on the cause of this and how I could rectify the problem?
Thanks,
Jason.